To indicate which of the class files holds the
main()
method, the JAR files needs to include a short Manifest
file with the text line
Main-Class:
MyApp
If the manifest file name is Manifest,
then to create the jar file use the -m
option as in:
c:\>
jar -cvfm MyApp.jar Manifest MyApp.class
An optional approach to running from the jar,
especially useful when you need to access classes in several
jar files, is to use the the classpath option -cp
as in:
c:\>
java -cp MyApp.jar MyApp
or in the case of several additional JAR files
c:\>
java -cp MyApp.jar;MyHelp.jar;MyUtilities.jar MyApp
More information about using JAR files can be
found in the following resources listed below.
References & Web
Resources