This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird Packaging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird Packaging" Watch "URLyBird Packaging" New topic
Author

URLyBird Packaging

Steve Schooler
Greenhorn

Joined: Jan 25, 2005
Posts: 9
Want to verify that I'm interpreting the instructions correctly. To avoid auto failure, I welcome criticism. I upload a jar file named <anyname>.jar, whose contents are:

  • <root>
  • <root>\META-INF\MANIFEST.MF
  • <root>\runme.jar {nested jar file}
  • <root>\db-1x3.db {original unchanged database file}
  • <root>\suncertify.properties {properties file}
  • <root>\code\<package1_name>\<source code in package1_name>
  • <root>\code\<package2_name>\<source code in package2_name>
  • ...
  • <root>\version.txt
  • <root>\docs\instructions.html
  • <root>\docs\choices.txt
  • <root>\docs\userguide.txt {et al}
  • <root>\docs\javadoc\<javadoc generated html files>


  • The contents of runme.jar are:

  • <root>
  • <root>\META-INF\MANIFEST.MF
  • <root>\<package1_name>\<class files in package1_name>
  • <root>\<package2_name>\<class files in package2_name>
  • ...


  • Decisions:
  • place db-1x3.db and suncertify.properties in same directory
  • suncertify.properties is NOT contained in runme.jar
  • app will allow db-1x3.db to be re-located and will provide JFileChooser to access it in "server" or "alone" mode
  • app will insist that suncertify.properties NOT be relocated.
  • if properties file not found by app (searching in current directory), it will be regenerated with default values.


  • Request corrections.
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11404
        
      81

    Hi Steve,
    Decisions:
  • place db-1x3.db and suncertify.properties in same directory
  • suncertify.properties is NOT contained in runme.jar
  • app will allow db-1x3.db to be re-located and will provide JFileChooser to access it in "server" or "alone" mode
  • app will insist that suncertify.properties NOT be relocated.
  • if properties file not found by app (searching in current directory), it will be regenerated with default values.

  • I am a bit confused with the comment that "app will insist that suncertify.properties NOT be relocated" along with "if properties file not found by app (searching in current directory), it will be regenerated with default values". Does this mean that if you cannot find the suncertifies.properties file in the current working directory then you will be copying the values in the suncertifies.properties file in the directory containing the jar file?

    Regards, Andrew


    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    Steve Schooler
    Greenhorn

    Joined: Jan 25, 2005
    Posts: 9
    Thanks for your interest. I am assuming that the current working directory is the directory that contains runme.jar. If you think this assumption may lead to trouble, please tell me. Regardless of whether it is or is not, I'm using "." to specify the path needed to find suncertify.properties. If you think this may lead to trouble, please tell me.

    When I posted this topic, I intended that if suncertify.properties was missing from the directory that contains runme.jar, that the program would automatically create a new version of suncertify.properties (with default values) in this directory. My intent was to demonstrate that I was handling the situation where the user had inadvertantly lost or corrupted the file. Naturally, I intended to place corresponding entries in choices.txt and userguide.txt.

    I have since changed my mind. I've tentatively decided to:
  • Include an additional copy, suncertify.backup in this same directory.
  • Have property-file-corruption or property-file-missing situations trigger a pop-up message that refers the user to a specific area of the userguide.txt file and then immediately System.exit(1) et al.
  • Mention in choices.txt that both the client and server (gui) Help menu items provide direct access to the user guide.
  • Also mention in choices.txt that it is assumed that the user has indirect access to this guide via a text editor.



  • I welcome your reaction to the above + the corresponding userguide.txt entry (below). I don't want to anger the evaluator with my arrogance.

    Andrew Monkhouse
    author and jackaroo
    Marshal Commander

    Joined: Mar 28, 2003
    Posts: 11404
        
      81

    Hi Steve,

    The way I read the instructions, I got the feeling that Sun were implying that there was no correlation between where the jar file was located or where the database file was located, and the current working directory.

    So in theory, I could have
  • the database file in c:\data
  • the executable in c:\program\scjd
  • and I could start the program from c:\temp

  • But I think that your original concept would have handled that scenario quite happily.

    [Side note: I think it would be extremely unlikely that the assessor would try such a scenario, but I think your program would have to be able to handle it if they did.]

    Personally I think your current proposal (exiting if suncertify.properties does not exist) is not very user friendly, and I don't think that it matches the requirement that "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." I think that if the properties file does not exist then you would be better off offering default values in the GUI and creating a new properties file.

    Regards, Andrew
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: URLyBird Packaging
     
    Similar Threads
    Packaging assignment jar...
    Building with ant
    NX: final packaging and the big JAR
    getResource always returns null
    URLyBird: runme.jar