• 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

Properties packaging

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I've gone through these two threads NX :-P ackaging suncertify.properties and Properties Files and ResourceBundle. I would like to know whether my conclusions are all correct.
Somewhere in those threads it says:

runme.jar is for both client and server, that optional mode argument determines what runs.
so "java -jar runme.jar" will run your GUI but attempt a network connection, "java -jar runme.jar alone" will run in standalone mode, and "java -jar runme.jar server" will run your server.


I have no doubts about that. The specs are clear.
I also presume that I should not pack a properties file into the JAR file I will submit ([spec] "The JAR file must have the following layout and contents in its root:"). This makes me believe the examiner will extract runme.jar and run the programs in the console.
The spec also mandates that all configuration information be stored in a file called suncertify.properties which must be locacted in the current working directory.
Conclusion:
The single file suncertify.properties stores all properties for client/server whether standalone or not. The file will therefore contain keys such as suncertify.db.datapath, suncertify.client.serverport, suncertify.server.port, etc.
When a program (i.e. client or server) is started for the first time, most likely it won't find a properties file because there is none -unless the examiner has created one himself ;-)
(In my case)Both server and client come with a GUI that allows to make persistent changes to the properties.
No further implications as only one program accesses a properties file at the time.
Please let me know whether I'm on the right track.
Regards,
Marcel
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Marcel. That's exactly what I did. Just make sure that if somebody creates his/her own suncertify.properties file and it's not valid (for example, has "suncertify.client.serverport_number" instead of your "suncertify.client.serverport"), your program can handle it (either by creating a new properties file altogether or just adding the appropriate key/value pair).
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I also presume that I should not pack a properties file into the JAR file I will submit ([spec] "The JAR file must have the following layout and contents in its root:").


I would suggest not packaging your own suncertify.properties file. (At least, I'm not doing it.)

This makes me believe the examiner will extract runme.jar and run the programs in the console.


I disagree with this. An examiner will not extract your runme.jar. More than likely the examiner will run your program from a command line such as:
java -jar runme.jar server
to start the server, then
java -jar runme.jar
to start the network client.
This is suggested in my instructions which state:

When you submit your assignment, each part (client and server) must be executable using a command of this exact form:
java -jar <path_and_filename> [<mode>]

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Min,

...for example, has "suncertify.client.serverport_number" instead of your "suncertify.client.serverport"), your program can handle it...


Oh sure, I'm specifically looking for the property with the name that I've defined. If it's not there - for whatever reason - I use a default value and save it right away in the file provided.
Regards,
Marcel
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Michael,

I disagree with this. An examiner will not extract your runme.jar. More than likely the examiner will run your program from a command line such as:


What I meant was: "The examiner will extract runme.jar FROM THE BIG JAR which may be called myCandidateID_scjd.jar or so and run it from the console" (as you and I in my first posting pointed out).
Regards,
Marcel
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic