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 server/alone command line 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 "server/alone command line" Watch "server/alone command line" New topic
Author

server/alone command line

Stephen Galbraith
Ranch Hand

Joined: Oct 27, 2003
Posts: 90
I'm getting close to submission (in more ways than one!) and I'm having last minute panics (on just about everything!).
Now it says in the instructions

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.

Now up until today I had always read that as meaning that the server mode of the client gui must started by typing server, with the standalone client side gui started with alone with a default setting to server if not entered at all.
And that's what I did. Now I'm not so sure
My new reading of it is....
typing server starts the server application (ready to accept new remote clients)
typing alone starts the everthing in standalone mode
typing nothing starts the client in server mode which attempts to bind to
the specifed server.
I had previously assumed that Sun assumed that the person starting the server had some basic Java knowledge and could cope with more typing to start the server. But now I'm worried.
Thoughts?
Thanks,
Steve.


SCJP 1.4, SCJD, SCWCD 1.4
George Marinkovich
Ranch Hand

Joined: Apr 15, 2003
Posts: 619
Hi Stephen,
Maybe this will help.
Your application can run in a networked or a non-networked mode. When you application is running in standalone mode it is running in the only non-networked mode. To run your application in standalone mode, you enter "java -jar runme.jar alone" at the command line.
When your application is running in networked mode things are a little more complicated. In networked mode you really have two instances of your application running at the same time in a client-server configuration.
One of these instances is running in server mode and it can be considered the server part of the client-server configuration. To run your application in server mode, you enter "java -jar runme.jar server" at the command line.
The other instance is running in network client mode and it can be considered the client part of the client-server configuration. To run your application in client mode, you enter "java -jar runme.jar" at the command line.
So, for any given instance of your application you will know it's operating mode from the command line argument from which it was started. There are only three cases:
1) STANDALONE MODE, java -jar rumme.jar alone: the only non-networked mode, requires no other instance of the application to be running.
2) SERVER MODE, java -jar runme.jar server: a networked mode, specifically the server part of the client-server configuration, requires no other instance of the application to be running (but will communicate with any applications running in network client mode that refer to this server).
3) NETWORK CLIENT MODE, java -jar runme.jar: a networked mode, specifically the client part of the client-server configuration, requires an instance of the application to be running in server mode (with which it will communicate if it is configured to refer to the server).
To state the obvious, when your application is running networked it means that you have one instance of your application running in server mode and at least one instance of your application running in network client mode. These applications can be on a single machine or on different machines, it really doesn't matter.
I think this comports with your most recent understaning of the requirement. I also think this is a correct understanding. If your application can run in these three operating modes and fulfill the requirements for operating in the given mode, then I think you're OK.


Regards, George
SCJP, SCJD, SCWCD, SCBCD
Stephen Galbraith
Ranch Hand

Joined: Oct 27, 2003
Posts: 90
Thanks for clearing that up for me.
It's all these "minor" misunderstandings of the spec that I'm trying to clear up and you've given me the confidence to implement the change!
Thanks
Steve.
Zafer Abu saeed
Ranch Hand

Joined: Mar 28, 2004
Posts: 40
I have a problem with this..
The specs states that:

Saying Each Part led me to believe that there should be more than one part(Jar).. and each part(Jar) must be Executable using the command line above.
But this conclusion conflicts with the rule of the command line argument (server vs alone vs nothing)..
Any body can explain this..


Thanks,<br /> Zafer<br /> SCJP, SCWCD
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Zafer,
Welcome to JavaRanch.
I would read this as "a part of your single executable jar file". So you only have one executable jar file, and you run different parts of it depending on what command line parameter (if any) is given.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Zafer Abu saeed
Ranch Hand

Joined: Mar 28, 2004
Posts: 40
Thank you Andrew,
I think you are right.
Although I thought that packaging all interfaces, classes, and stubs (if RMI is used) for both sides (client and server) in a single Jar file will be a bad practice..
But it seems this is the requirement.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: server/alone command line
 
Similar Threads
standalone vs. net client clarification
packaging final application
commandline argument
Mode flag
B&S suncertify.properties