C:\>java -jar SCJD\runme.jar server Starting RMI Server... path: file:/C:/SCJD/runme.jar!/server.properties
C:\SCJD>java -jar runme.jar server Starting RMI Server... path: file:/C:/SCJD/runme.jar!/server.properties
I should now be a pice of cake.
Joined: Dec 31, 2004
I must tell you, Jorgen, that although your strategy could work, the most probable is that the settings that you put on the suncertify.properties file will have to be changed by the user every time he runs the application.
For instance, in my suncertify.properties I put the path to the data file, the port number used by server and clients, the default encoding, among other things.
When I start the server, I let the user choose where the file is, what port he wants to use, what 8-bit encoding he wants to apply to the file, etc. Once he aproves the settings he can start server.
Therefore, copying a file from the runme.jar to the local directory might work to set initial values for the settings, if you want to do so, but you cannot assume that the settings in your file are correct.
For instance, the port that you chose to put in the properties file might be used for other purposes on the evaluator machine. The data file could be located in other place, etc.
I tell you all this, because at the begining I was doing the same thing as you are now, and I changed my mind at the end. [ October 18, 2006: Message edited by: Edwin Dalorzo ]
Joined: Oct 18, 2006
Hi again Edwin.
I agree that the outcopied properties file is just for default settings, and should be changed from a GUI before the RMI server is ready for clients.
My initial question was that I always want to keep the runme.jar and the propertyfile in the same directory, independent of path structure in the -jar argument.
1) Check if there is a properties file in the current directory. 2) If there is, start normally with the values stored in the properties file. 3) If there isn't, create a new properties file in the directory, populated with default values.
This ensures that you never overwrite the user's properties by accident.
McFinnigan? Never heard of him. Nobody here but us chickens...<br /> <br />SCJP for Java 1.4<br />SCJD for Java 5.0
Joined: Oct 18, 2006
Thanks for the advises, this is how my server works now, maybe I'm starting to do this properties issue too complex. Leave it for now, time to code something more important.
In my assignment i simply check if there exists the properties file. If not then i show an error message and quit. Most of the applications work like that. After all you need to take a stand as to where to draw the line. If you mess up with the properties then what will can you do? It is a nice to have that you load a default set of properties but then what is the SCOPE?
I added the various UI Strings and labels as well to the properties but then it added a lot more complications. What is the Date Format (picked from props) is incorrect? what do you do? again go to the default properties?