File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes command line parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "command line parameter" Watch "command line parameter" New topic

command line parameter

Dan Murphy
Ranch Hand

Joined: Mar 29, 2005
Posts: 126

Regarding the single command-line parameter which may be provided when running the application, my assignment instructions say:

"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"

I understand this to mean:

- If 'server' is provided *only* the server should start on the local machine
- If 'alone' is provided, the program should run in "non-networked" mode
- If neither is provided the client and server should both start on the local machine, and the application runs in networked mode

If this interpretation is correct, then there doesn't appear to be any way for a client to connect to a server running on a different machine. If so, what is the point in just starting the server (when the 'server' command argument is provided)?

Thanks in advance,

Ronald Wouters
Ranch Hand

Joined: Apr 28, 2005
Posts: 190
If neither is provided ... the network client and gui must run

This doesn't mention (explicitely) the server should start on the local machine.
So, in my opinion this means that you can start the server either on the local machine or on different machine entirely using the 'server' mode flag.
The user probably needs to be prompted for the location of the server when the network client starts. At that moment the user can choose "localhost" or "" .

Ronald Wouters

Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5
Dan Murphy
Ranch Hand

Joined: Mar 29, 2005
Posts: 126

Thanks for your reply. If the user chooses localhost I guess you could provide an option to "start server now" which they would select if the server isn't already running on the local machine.

I'd be interested to hear how other people interpreted these instructions or if they provided a feature such as the one I'[ve described above

Daniel Dalton
Ranch Hand

Joined: Mar 20, 2005
Posts: 146
I took it to mean the simplest possible thing:

server - start the server, here on this local machine on the specified port.
alone - run the program here in non-networked mode
nothing provided - run the program here and try to connect to the server on the previously specified port and address.

In my opinion, starting the server on the same machine as the client automatically would be less useful than simply giving an error message if the server could not be located.

Given a network of machines, the server option allows you to start up a server somewhere. If you make your client give you a way to specify the address of the server, the no parameter option allows you to connect to the previously started server.

Hope that helps!
I agree. Here's the link:
subject: command line parameter
It's not a secret anymore!