Java uses the command line to package Jar_java

Source: Internet
Author: User
1. Mode of command line:
Packaged
Jar CF jar file name program file name or folder where the program resides
Example:
Jar CF Myapp.jar D:javaprojectmyapp
View the contents of a JAR file
Jar TVF JAR file name
Example:
Jar TVF Myapp.jar
Unzip a jar file
Jar XF JAR file name
Example:
Jar XF Myapp.jar
Add files to the compressed package
Jar XF jar file name added file or other JAR file
Example:
Jar XF Myapp.jar Test.class
Update a JAR file
Jar uf jar file name updated file or other jar file
Example:
Jar UF Myapp.jar Test.class
Run a JAR program
Java-jar jar file name
Example:
Java-jar Myapp.jar
Create a jar file that can be run
First we have to have a main class (main)
Create a text called MANIFEST.MF, and then copy the contents.
manifest-version:1.0
Main-class:yourmainclass
This yourmainclass is the class that contains the main method in your program.
The following statement is used to create an executable jar file.
Jar CVFM Myapp.jar MANIFEST. MF file or folder path

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.