• 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

URLyBird 1.3.2 : Configuration Doubt

 
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys, I have a little bit problem regarding configuration file.

The assignment requires me to store the configuration file to working directory What does it mean? Does it mean I must put the configuration file to the same folder with the jar file when I save the configuration?

Do I must use the Property class? Or use the XML file to store the configuration file?

One last thing. What configuration that should be stored? The instruction doesn't say anything about it so I'll assume the client will store the server's address or database location (in local mode), and the server will store the database location. I choose hard-coded port number.


Jeffry Kristianto Yanuar
SCJP 5.0
SCJA
SCJD (Working on UrlyBird 1.3.2)
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Do I must use the Property class? Or use the XML file to store the configuration file?



God, no!!!

About this requirement, you need to have a suncertify.properties file in the current working directory. This will store the configuration the users provide when the application starts in the 3 different modes. For instance, I get your runme.jar file and place it in my C:\Jeffry-SCJD directory. I run your file with java -jar runme.jar server. Since there isn't still a suncertify.properties file in the C:\Jeffry-SCJD directory, your application will create the file there. But what should be stored there? For instance, in my case, for the server initialization, I ask the user to provide the port number and the database location. Remember that, at this point, I'm starting the server, so clients can connect to it. When the user provides these information, I store these information in the suncertify.properties file in the current working directory (System.getProperty("user.dir")). I used the java.util.Properties class to store the properties, then java.io.FileInputStream to physically store them. Then, the next time the user starts the application in server mode, the fields of the configuration window will already be filled with the options the user provided the last time the application was started in server mode. Each initialization mode (identified by the parameter in the command line) has its own fields. These fields are the ones you judge necessary to start your application.
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So in one configuration file, There are three configuration:
- For client networked mode (storing server's address)
- For server mode (storing database path)
- For stand alone mode (storing database path)

Is it like that?

thanks
 
Roberto Perillo
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

So in one configuration file, There are three configuration



Yes, that's it partner!
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Roberto & Jeffry ,

When i package the application to runme.jar or further package the runme.jar to final submition ,should I package the property file named suncertify.properties to the package for submit?

Thanks a lot!!
 
Jeffry Kristianto Yanuar
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't do that because in my assignment didn't say so.

I already pass the SCJD exam, You woke the zombie thread and the zombie will come into your house


Anyway, good luck in your assignment. If you get a problem, don't hesitate to make a new thread.


Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
 
Roberto Perillo
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When i package the application to runme.jar or further package the runme.jar to final submition ,should I package the property file named suncertify.properties to the package for submit?



No. This file has to be created in the working directory only if there isn't still one.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic