• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You/we are.
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic