(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