• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is this Properties File?

 
Seetharaman Iyer
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

From Req Doc :
Your programs must not require use of command line property specifications. 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.


1. What kind of configuration must be done/stored in properties file?
2. Is it mandatory to use properties file ?
3. Current working directory means? - I know user home directory and the way how to access it ("user.dir"). How to get current working directory?
Example : my runme.jar is located in the path : C:\Testing\SCJD\runme.jar. In which directory, properties file will be stored.
4. Do I have to include suncertify.properties in the deliverables (submission jar)?
5.
All configuration must be done via a GUI
means ? - Each property in the file must have associated field in GUI? Example: server location text field for the property "server.location"
 
Roel De Nijs
Sheriff
Posts: 10429
133
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1/ This will be an interesting thread about properties file.
2/ all "musts" in these sentences, so yes it is mandatory. (violating a must requirement = automatic failure)
3/ I used System.getProperty("user.dir"); to get the location to store my properties file
4/ No, you should not package it in your submission.jar nor runme.jar. The 1st run the properties file should be created at the desired location
5/ All the properties which are stored can be changed in a GUI.
 
Seetharaman Iyer
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Roel for your timely help.

Just three more questions.
1. How to read the properties file? Reading properties file is just like reading other normal text files by using RandomAccessFile/BufferedReader?
2. I planned to include following fields in the properties file.
a) "server.dbpath"
b) "server.port"
c) "client.ipaddress"
d) "client.port"
e) "standalone.dbpath"

In "server" mode --> properties a and b will be used for reading/updating the settings
In networked client --> properties c and d will be used for reading/updating the settings
In "alone" mode --> properties e will be used for reading/updating the settings
My assumption is, launching the application in different mode on the same machine will not affect other mode settings. Is this perfect?

3. Which option is good? a) Hard-coded port number or b) as per above - explicit port number setting. I prefer option b as attempting to use the taken (already in use by other application) port number will stop the user from proceeding further (I think it will throw the error like "address already in use - can't bind"). This explicit port number setting will enable the user to choose another free port number.

Thanks,
Seetha...
 
Roel De Nijs
Sheriff
Posts: 10429
133
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1/ Maybe have a look at the Properties class.
2/ I include just 3 properties: db path (used for network server and stand alone client), port (used for network server and network client), server address (used for network client).
3/ answered in 2/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic