tenth. deploying Applications and applets 10.1 jar File
Jars can contain either class files or other types of files like sound, and jar files are compressed in zip format.
To Create a format:
Jar CVF jarfilename File1 File2 ...
For example:
Jar CVF Calculatorclasses.jar *.class icon.gif
JAR Command format:
Jar Options File1 File2 ...
Options:
10.1.1 manifest file
Each jar file contains a manifest file (manifest) for describing the characteristics of the archive
Manifest file name: MANIFEST.MF, located in a special Meta-inf subdirectory of the jar file.
The manifest entry is divided into sections. The first section is the main section. Acts on the entire jar file. Subsequent entries are used to specify the attribute of the ordered item, which can be a file, package, or URL. Must start with an entry named name. Split between sections and sections with a blank line. Such as:
Manifest-version:1.0 describes the line of this archive Name:Wcozle.class describes the line of the file name:com/mycompany/mypkg/describe the line of the package
To edit a manifest file, you need to put the lines you want to add to the manifest file into a text file and run:
Jar CFM Jarfilename Manifestfilename ...
For example:
Jar CFM Myarchive.jar MANIFEST.MF com/mycompany/mypkg/*.class
See more Http://java.sun.com/javase/6/docs/technotes/guides/jar.
10.1.2 can run jar file
In Java SE6, the e option of the JAR command allows you to specify the entry point of the program, which is typically the class you specify when invoking the Java program loader:
Jar Cvfe Myprogram.jar com.mycompany.mypkg.MainAppClass files to add
users can start the application simply:
Java-jar Myprogram.jar
In the old JDK, you must specify the application main class:
Main-class:com.mycompany.mypkg.mainappclass
Do not add the extension. class to the main class name. Then run:
Jar CVFM Myprogram.jar mainclass.mf files to add
Note: The last line of the manifest file must end with a newline character.
Tenth. deploying applications and applets