aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes question about  suncertify.properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "question about  suncertify.properties file" Watch "question about  suncertify.properties file" New topic
Author

question about suncertify.properties file

Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
-It is indicated in my assignment "All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."

In my implementation, if the user change the working directory, suncertify.properties file will be recreated from scratch, all the properties stored in the suncertify.properties file when working in the old directory will be lost. Does this fit with the exam spec?

if not, how can I keep the same suncertify.properties file even when the user changes the working directory?
Bhavik Patel
Ranch Hand

Joined: Jul 12, 2004
Posts: 155
Is it required that user changes the working directory ( means your root directory of the application)...User can change only the datbase file locatio n..It means GUI should take care for databse file location ( and port and host in network mode) .I don't see any other things to be persisted in suncertify.properties.Does your specs say that user should able to change the working directory ..(think ..you will only give a jar file ..so only thing user is concerned at most db location,host and port..)..Hope it helps..


SCJP 1.4<br />SCWCD 1.4(91%)<br />Working on SCJD -Bodgitt & Scrapper Constructions...<br /> <br />"It takes 43 muscles to frown & 17 to smile but it doen't take any to just sit there with a dumb look on your face .. Keep Smiling "
Vairoj Arunyaangkul
Greenhorn

Joined: Sep 23, 2006
Posts: 9
From my understanding, a working directory is the directory where the program is launched. So for example, if the jar resides in /home/myself/scjd/runme.jar, I can invoke runme.jar from /home/myself/scjd, and that's the working directory. Or I can invoke it from /home, and that makes /home the working directory.

So I think it's possible that user could change the working directory. That leads to the interesting question that Mike raised.
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
That's it

Is it required to keep the same suncertify.properties file even when the user changes the working directory?

Best Regards
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
When you run your application, do you have any idea if it has ever been run from another directory?

What I do is the next. I have a default definition on my suncertify.properties file stored in the runme.jar file. When I run the application I check if the file exists in the current working directory (System.getProperty("user.dir").

If the file is not in the current directory then I copy it from the the runme.jar and store the copy in the working directory. Then I display a dialog box for the user to check the current settings.

If the user is going to launch the application from another directory he would be responsible for moving the suncertify.properties settings to the new working directory.

Sadly, the instructions.html file states that the suncertify.properties file should be stored in the working directory.

Otherwise I could have saved the file in the user's home directory in hidden application settings folder like /home/edalorzo/.urlybird or somewhat like that. This way it would not matter where the user moves the working directory, I would always load the settings from his home folder.

If you want to keep the settings even when you move the working directory, then you will have to store them in both places, the working directory and in the user's home directory.

The first time the application is run you must create the application settings directory as a hidden file in the home folder.

Then make a copy of the file in the current working directory and run the application from there, using that file.

If the user changes the settings, you change them in both places.

If the user changes the working directory, then you check in the application settings directory exists in the home folder and make a copy of the file in the current working directory. This way, you would be keeping the settings no matter if the user change the current working directory.

This strategy, notwithstanding, is more than what the specification requires.
[ October 02, 2006: Message edited by: Edwin Dalorzo ]
John Hessing
Greenhorn

Joined: Aug 22, 2006
Posts: 3
I think you all are making big problems about nothing!

I guess we only have to make sure the settings are persistent in the working directory, so the user doesn't need to retype his settings the next time the app is launched again from the SAME (!!!) working directory...
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Hi

does someone pass the exam withbout carrying about the user working directory? I mean if the user changes the working directory, the suncertify.properties file will be recreated from scratch and the user will have to provide again all the settings via the GUI.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about suncertify.properties file
 
Similar Threads
must be persistent between runs of the program&#65311;
question about "suncertify.properties" file
Read file from Jar - Exception
Passed SCJD with 367 / 400 (91,7%)
NX: suncertify.properties