Runnable JAR archives
| |||
You can run a program stored in the JAR
archive that has a main() method like this:
% java -cp eharold.jar MainClassName You must use the fully package qualified name. For example, % java -cp eharold.jar edu.poly.utopia.eharold.games.Trivia The -cp flag adds the jar file to the class path. In Java 1.2 you can add a
Put this line into a file called (for example) MyManifest.txt. Then use this command line to package the JAR: % jar cvmf MyManifest.txt eharold.jar edu This will copy data from the file MyManifest.txt into the JAR's own manifest file, and add the directory edu to the archive. To run the program packaged in the jar file eharold.jar you simply type: % java -jar eharold.jar Java will look inside the JAR archive's manifest to find
which class's | |||
|