1. Prepare the main list file "MANIFEST. MF "
manifest-version:1.0 Class-path:lib/commons-codec.jar Lib/commons-httpclient-3.1.jar Lib/commons-logging-1.1.jar Lib/log4j-1.2.16.jar Lib/jackson-all-1.8.5.jar Main-class:com.action.maintest
The first line is the version of Mainifest.
The second line Class-path specifies the location of the foreign jar package
The third line specifies the main Java file that we want to execute.
Here are some points to note
Class-path: And Main-class: There is a space behind, it must be added, otherwise the package fails, error message: Invalid header field;
Assuming that our project is packaged for Maintest.jar, then as defined above, a Lib folder (i.e. Lib file and packaged jar file in the same directory) should be created in the Maintest.jar directory, and the relevant jar package will be placed inside
Be sure to enter after you finish Main-class (that is, the last line is a blank line), and let the cursor go to the next line
2. Export the jar file using the Eclipse's export function you need to select the established MANIFEST during the export process. MF file and then fool-type operation
3. You should create a Lib folder (i.e. Lib files and packaged jar files in the same directory) in the same directory as the Maintest.jar, and put the relevant jar packages inside
4.1> Run command under command line Java-jar Maintest.jar
2> Create a new batch file, such as Start.bat, the content is: Java-jar Killcheatfans.jar pause in the jar file in the same directory, and then click to automatically run, more convenient
How eclipse hits the jar package