All elements of your submission must be packaged in a single JAR file. The JAR file must have the following layout and contents in its root:
The executable JAR containing the programs. This must be called runme.jar.
Also the spec states that to run the executable jar i can only type :
java -jar <path_and_filename> [<mode>]
I know i can make an execuable jar by specifying the class to run in the manifest file. But if i can only specify one class how can both the server and client be run and how does the user specify which must be run?
I guess my question is how to specify what class to run in the jar file as there re two classes with main methods.
I have a single AppLauncher class that I mention in my jar manifest. Depending on the mode parameter my AppLauncher launches whatever the mode requires (server, alone, network client, missile to the moon ). Check your instructions on this.
Sun Certified Developer for the Java 2 Platform
Sun Certified Enterprise Architect for the Java Platform, Enterprise Edition 5
Joined: Oct 13, 2005
Thats initially what i was thinking but then both the server and client would have to be run if using say server mode. This would mean that a client running on a different machine in server mode would also have a server running. Surely this would not be correct.
What i think they are looking for is a way to run the server and another to run the client from the same jar file.
But im really not sure.
Joined: Oct 13, 2005
Ive just seen what you mean sorry mate. And yes your definatelly right i see now if the argument is left out entirely then a network client must run.
Am currently working on this bit too. 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 think I will make a kind of application launcher too, which is the program always executed when running the jar. This will recognise which of the three options is desired and either start the server or the client (in local or network mode accordingly)