Eclipse Build Jar Package

Source: Internet
Author: User

First: Ordinary class export jar package, I mean the ordinary class refers to this class contains the main method, and no other jar package.

1. Select the class or package you want to export in Eclipse, right click and select Export Sub-option;

2. In the dialog box that pops up, select the Java file---Select the jar files and click Next;

3. Select the location and name of the jar package you want to generate in the text box behind the jar file, and note the export generated class files and resources and export Java source files and resources Tick the front, click Next;

4. Click the Next button two times to reach the jar Manifest specification. Note In the text box at the bottom of the main class, select the entry class for your jar package. Click Finish to finish.

In a DOS environment, you can enter the directory where your Jar is located and run the Java-jar name. Jar to detect if the operation is correct.

Second, you have to export the class inside the use of other jar package. For example, you write a class connected to the database, using the database driver package Oracl.jar.

1. First export the class you want to export to form a jar package, for example, called Test.jar

2. Create a new folder main, for example, in the D packing directory;

3. Copy the Test.jar and Oracl.jar to the main file, right-click Test.jar and unzip to the current folder. Put Meta-inf\manifest. MF Cut to another place (such as the desktop!) ) ;

4. Right-click Oracl.jar and unzip to the current folder.

5. In a DOS environment, enter the main folder of the D drive and executejar CVFM New.jar meta-inf/manifest.mf., don't forget the point at the end.

6. Use the compression tool to open your newly generated New.jar, using the meta-inf\manifest you put on your desktop. MF Cover New.jar original.

In a DOS environment, you can enter the directory where your Jar is located and run the Java-jar name. Jar to detect if the operation is correct.

Eclipse Build Jar Package

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.