wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Running server/client separately in runme.jar 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 "Running server/client separately in runme.jar" Watch "Running server/client separately in runme.jar" New topic
Author

Running server/client separately in runme.jar

Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
The requirements seem to repeatedly insinuate the fact that the client and the server should be executable on two separate JVMs possibly on two separate machines. This implies starting two different programs through java -jar <file> [<mode>].

However, my deliverables seem to clearly state that only one archive, runme.jar is to be submitted as the sole executable. As far as I know, one jar can only have one main class attribute. Anybody have any idea how I'm supposed to get the server and client started separately through the same jar? Is this a problem with the requirements or am I missing something? Thanks in advance...


Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
Michael Green
Greenhorn

Joined: Dec 17, 2004
Posts: 6
The assignment is correct.

You're assignment should describe command args you can must support for executing the assignment in various modes.

This means your main class will have to handle these args and be able to launch your application based on the command args


Also you will need to make an executable jar file. Try googling this for how to do so
Reza Rahman
author
Ranch Hand

Joined: Feb 01, 2005
Posts: 580
    
    5
OK, so I think you are saying the following:

1. The Main-Class in the jar should really inspect the <mode> operator and dtermine which part of the project to run. Such as:

a. if <mode> = "server" then run the database server.
b. if <mode> = "alone" then run the client GUI using the database in
local mode. In this case, do you think the options panel should still
allow the user to change their mind?
c. if <mode> is not specified, run the client in network mode. Same
question as above here.

This certainly would cover all the possibilities, does this seem sensible? Thanks for the input...
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
You got it. The jar could be distributed among n machines, whether the machines are real or virtual, and the user would start each copy of the jar in whatever mode the user needed, such as server or standalone on the server, client on any other machines that want to access the server's database...


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
GD Deepz
Ranch Hand

Joined: Sep 29, 2004
Posts: 55
"The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run"

Ok, this is how I interperted it:

1. If mode flag = "server", "only" run the server/database and nothing-else. This indciates standalone.

2. If mode flag = "client without networking", "only" run the client/gui/database without the server. This means client/gui/database all runs on the same machine. No networking.

3. If mode flag = "client with networking", run the client/gui/server/database. This means client/gui/server/database can run on different JVMs and machines. Note in this mode, the server must be launched first.

So basically there are 3 ways to start the application. Feedback anyone?

Anyone knows what this means:

"All configuration must be done via a GUI, and must be persistent between runs of the program"
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
You are on the right track, just make sure you are using the correct mode flags. It must only be "server", "alone", or left out completely. For instance, "java -jar runme.jar alone" will start the stand alone client, and "java -jar runme.jar" will start the networked client.

As far as the second part - "All configuration must be done via a GUI, and must be persistent between runs of the program" - I understand this to mean that any configuration such as selecting the location of the data file or specifying the host IP must be done from a GUI. That is, NOT from the command line. Also, if you are using RMI, you must start it from your program, not from the command line. Basically, the assessor should only need to type in the command listed above, and nothing else.

To make them persistent, you can save the information in the suncertify.properties file and load them when you start the application. That way the assessor doesn't have to do anything if the configuration has not changed.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
 
Consider Paul's rocket mass heater.
 
subject: Running server/client separately in runme.jar
 
Similar Threads
Several Questions about submissions
NX Contractor - startup mode
Help Needed for SCJD Assignment Deliverable
NX:Contractors: Structure of package
Some more Queries on URLyBird