• 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

Current Working Directory?

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
suncertify.properties must be located in the current working directory. I will like to confirm it it means the location where runme.jar is located.
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are incorrect. It means whatever directory you run the runme.jar file from...which doesn't have to be the directory where it's located (for example. if you have it in your CLASSPATH, you can run it from anywhere).
 
Liang Anmian
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But how will you know where the user is running the JAR file? Supposed I use a File object. Do you mean that this alone will suffice?

 
Eric Chang
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used a FileReader and FileWriter to read and write my properties file.
 
Liang Anmian
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So that means the path is correct?
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way I read this requirement is:

The suncertify.properties file must be in the current working directory, which is available as a system parameter called user.dir. If the file does not exist, create it.
 
Liang Anmian
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wonder if I'm doing anything wrong. I created a sample JAR file, and set the directory which contains that JAR file in the classpath. I tried running the JAR file somewhere else, but it doesn't work. It's called "runme.jar", and I placed it in my root folder (C:\). I place "C:\" in the classpath, then I tried running the JAR file somewhere else with:

java -jar runme.jar

It doesn't work. I tried putting "C:\runme.jar" in the classpath too, but it doesn't work too.

By the way thanks for the "user.dir" solution. I've forgotten that such a property exists.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...

I did not see any musts regarding creating a new config file if it doesn't exist.

Did you guys read it like that?

If the config file is put where the runme.jar is located, and an error message if the file can't be found (saying suncertify.properties is not in the current directory) should suffice, surely?

Opinions?

Cheers /Dave
 
David Abramowicz
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm... This thread:

https://coderanch.com/t/185901/java-developer-SCJD/certification/They-faild-me-don-know

is certainly contradictory to my theory. Seems some poor lass failed due to not auto-creating a suncertify.properties...

/Dave
 
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Abramowicz:
Hi...

I did not see any musts regarding creating a new config file if it doesn't exist.

Did you guys read it like that? ...



Yes, I read the configuration and packaging requirements to require that the program must be able to start in its default mode using what is specified in the packaging, which does not include a properties file.
 
reply
    Bookmark Topic Watch Topic
  • New Topic