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
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.
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.
posted 14 years ago
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
posted 14 years ago
You have to be odd to be #1 - Seuss. An odd little ad:
Download Free Java APIs to Work with Office Files and PDF