aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: How to locate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: How to locate "suncerity.properties" in the current working directory? " Watch "NX: How to locate "suncerity.properties" in the current working directory? " New topic
Author

NX: How to locate "suncerity.properties" in the current working directory?

Sang-Wook Kim
Ranch Hand

Joined: Jan 07, 2004
Posts: 36
Hello,
I am working on URLyBird and have a question about how to change
the path of the properties file. I have a class that handles the
properties in the suncertify.client package and I use "System.getProperty("user.dir")" function to get the path. The thing is that I have
to save the properties file in the current working directory, which
is 2 directories above suncertify/client directory. I was thinking
of doing like this:

I wrote "\\suncertify\\client", because I am sure that the ending
directory would like this. But I am not sure whether this would
also work on Linux. I belive it would work since the only difference
is that Linux uses "/" instead of "\". (Please correct me if I am
wrong) Is there a better way of doing this or would this be ok?
Kim
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hi Kim, regarding properties file I think what they mean by it is this. Our application is sent as an executable jar to them. So no matter where they run the application, the application should create a properties file in that particular directory and use it. I think that is what they mean from this "properties file should be in the current working directory". This you can do in the way you said as getProperty("user.dir").
Good Luck.
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Kim,
I confirm what Satish wrote above. System.getProperty("user.dir") returns the directory where the JVM was started. It can be or not the directory where your executable jar file resides, but it's what SUN means in our instructions by "current working directory".
Regards,
Phil.
Sang-Wook Kim
Ranch Hand

Joined: Jan 07, 2004
Posts: 36
Hi Satish & Phil,
Hope I am getting it right. So System.getProperty("user.dir") gives
me the path of the directory in which I execute the program instead
of the path of the class which uses this function, because as Phil
wrote, System.getProperty("user.dir") returns the directory where the JVM was started. Am I correct?
Kim
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
You/we are.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: How to locate "suncerity.properties" in the current working directory?