aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Executable Jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Executable Jar File " Watch "Executable Jar File " New topic
Author

Executable Jar File

Patrick McDonogh
Ranch Hand

Joined: Oct 13, 2005
Posts: 89
Hi all,

my spec states :

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.

This has really got me stumped.

Thanks in advance for the help.
Ronald Wouters
Ranch Hand

Joined: Apr 28, 2005
Posts: 190
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
Patrick McDonogh
Ranch Hand

Joined: Oct 13, 2005
Posts: 89
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.
Patrick McDonogh
Ranch Hand

Joined: Oct 13, 2005
Posts: 89
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.

Thankyou
Gareth Tomes
Greenhorn

Joined: Nov 04, 2005
Posts: 2
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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executable Jar File