Java Reference
In-Depth Information
Place that in a file called, say, manifest.stub , and assuming that you want to run the program
HelloWorld from the given package. You can then use the following commands to package
your app and run it from the JAR file:
C:> javac HelloWorld.java
C:> jar cvmf manifest.stub hello.jar HelloWorld.class
C:> java -jar hello.jar
Hello, World of Java
C:>
You can now copy the JAR file anywhere and run it the same way. You do not need to add it
to your CLASSPATH or list the name of the main class.
On GUI platforms that support it, you can also launch this application by double-clicking the
JAR file. This works at least on Mac OS X and on Windows with the Sun Java runtime in-
stalled.
Mac OS X Specifics
On Mac OS X, you can use the Jar Bundler (available under /usr/share/java/Tools/Jar Bund-
ler.app ). This provides a windowed tool to specify the options set by my MacOSUI package
(see Enhancing Your Swing GUI for Mac OS X ) as well as CLASSPATH and other attrib-
utes. See Figure 21-2 .
Search WWH ::




Custom Search