Hit Jar bag

Source: Internet
Author: User

Why do you want to hit the jar bag?

1. Because the user will not run the class file, and will not compile the Java files, they will only double-click Open ...
2. If you develop 100 classes for others to use, wouldn't you give someone 100 class files?
That's too messy, just give him a file: Package 100 class files into a jar file

To hit a jar package:

Need to use the development tools (Jar.exe) to the JDK.
Usage of jar:
Jar CVF jar file name class file or folder

For example, the test folder under the current directory is called a jar package named CT
jar CVF Ct.jar test

Double hit the good Ct.jar file, and nothing happens ... A good shot into a jar, the user double-click open to run it???
Things to note in the jar pack:
1. After a program has finished the jar, you must specify the entry class on the manifest file: Format main-class: Package name. class Name
2. jar package Double-click to run a program that works only for the graphical interface, which does not work for the console program.


The role of the jar file:
1. Easy for users to run a project quickly.
2. Provide tool classes to others in the form of a jar package.


If you use the class inside the jar package, you must first set the Classpath path.

Classpath path not only affects Java virtual machines, but also affects Java compilers

JRE = jvm+ Core Class Library

Hit Jar bag

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.