1. Select the project you want to export.
For->export, choose Java in the following Jar File->next, select the path->next,finish you want to export.
2. Select the exported jar file to open with compressed file Manager
3. There is a Meta-inf folder, the inside of the MANIFEST.MF file dragged out. At this point the manifest file content should have only the following line:
</pre><pre code_snippet_id= "439185" snippet_file_name= "blog_20140731_2_9115505" name= "code" class= "HTML" ><span style= "FONT-SIZE:24PX;" > manifest-version:1.0</span>
4. Change the MANIFEST.MF. I changed the following content for example:
Manifest-version:1.0main-class:javamail. Javamailtest Class-path:mail.jar
Main-class is followed by the class where the main function is located, and JavaMail is the package name.
Class-path is the external jar that is used in the back, and is separated by a space when there are multiple.
My Mail.jar and my own exported jar package are in the same folder, so no other path is written.
Note: Manifest-version,main-class,class-path followed by a colon, followed by a space , followed by the content. Always remember to use the carriage return at the end of each line. Contains the last row. That is, in my file, when the last close, the cursor position should be in the Class-path of the following line, on the safe side, you can also knock two spaces. (There is no reason why, the MANIFEST.MF file format is required = =)
5. Drag the modified MANIFEST.MF file back into the original jar and overwrite the original MANAFEST.MF.
6. The exported jar package can be executed,
e.g. command line input
Java-jar F:\tyqtest\AutoSend.jar
============== Cutting Line ======
later found that the method written above is very stupid, export the export as an executable package (runnable), and select the packages required libraries into generated jar (import the referenced external package to the generated jar package ) = = then you can.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Java project exported as an executable jar package