Hi Zhi
1. java -jar runme.jar alone --> local mode
Using JFileChooser to select the db.db location
and save into suncertify.properties
Looks good.
I went a step further and checked if db.db was in the working directory, and if so, offerred it as a default.
2. java -jar runme.jar server --> server
get the port,host,db.db location save into suncertify.properties
(is there any API, that i can use for getting a list of port and host?
I do not think that there is any way to get a list of available ports / hosts programattically. To try and find a currently running registry would require some sort of port scanning. To try and find "any available port to start my own registry" would be very easy, but would cause havoc for the users "gee, what port is the server on today

). And trying to find all the local hosts on the local subnet might not be possible, especially if the system administrator has deliberately turned off all services that would indicate what the server is / where it is (I have worked in companies where that happens: if you dont know the hostname and port you need to use, you wont even know the computer exists).
A better (IMHO) option is to just go with the defaults (hostname = localhost, port number is the "well known" port number for RMI), then allow the user to override them if they want to.
where is suncertify.properties sit, in the jar or user need to select the file from JFileChooser)
My properties file did not exist until after the user attempted to run the application, after which it was created in the current working directory. On subsequent runs, if there was a properties file in the current working directory then my app used it.
You could store it in the jar file, but I think this is going to be far too much hard work for no real benefit.
3. java -jar runme.jar -->network client and gui
retrive from suncertify.properties
(do i need to start the server in here/or just assume is started by No.2?)
Your choice,
but document the choice Personally, I think that starting the server from the client is wrong - what happens if someone decides to shutdown the client, not realising that it has also started the server and there are other clients attached? Sure, you can put up dialog boxes warning the user that this could cause problems, but to me, the client and server should be distinct applications.
Regards, Andrew