Tenth. deploying applications and applets

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.