Eclipse Export Jar Package

Source: Internet
Author: User

(1) When you write a project that does not refer to someone else's jar package

Select project----> Right button, Export ...--->java---> select jar file--->next--> Select the path and name of the jar file (that is, the place and name to store)-->next-- >next---Select Main class--->finish.

(2) When you write a project that references someone else's jar package

First, put the jar packages you generated and the others you reference into the same folder

Next, generate the main file:

Select project----> Right button, Export ...--->java---> select jar file--->next--> Select the path and name of the jar file-->next-->next--- Select Main class, at this point to select the Main class window, but here first do not select the main class, select the top generate the manifest file (generate manifest file), tick the Save the manifest in the Workspace (Save the manifest in the workspace), in manifest file: Enter the name of the file, such as/testproject/main, where TestProject is the project name and main is manifest Name of file) click Finish.

The generated jar file will produce an error as soon as it runs: couldn ' t find main class

Back to the project again, open the main you just generated, and enter the following information here:
manifest-version:1.0
Main-class:com.pacong.convert.auto.propertes.convertautoproperties

The above two behaviors are generated automatically, manifest-version:1.0 is the Manifest version number which is just automatically generated;
Main-class:com.pacong.convert.auto.propertes.convertautoproperties is the class where main class is located;

Then we add the following line
Class-path:jxl.jar Gephi.jar

Class-path:jxl.jar is the name of the external jar package, which tells the exported jar package, the path and name of the external jar package to be used, and refers to a number of packages separated by spaces
You can export the jar package with the external jar package when you're done with it.

Attention:

There is only one space behind the Main-class,class-path, otherwise it will prompt format error

Finally, there must be a newline, no spaces. This is also to be noted. Otherwise, there is no mainclass.

Finally, export the jar again, overwriting the jar package just exported

Select Project---> Right, Export--->java--->jar file---> select the path and name of the JAR file--->next--->next--->next, Then came the window to select Main class, but here also do not select the main class, select the use existing manifest from workspace, in the manifest file: Select the main just generated, such as:/ Testproject/main, click Finish, and that's it. Assuming the name of the generated jar package is Test.jar, the Jxl.jar introduced in Class-path will be in the same directory as Test.jar.

The content of this article is referenced: http://blog.csdn.net/luoweifu/article/details/7791712

Eclipse Export Jar Package

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.