1. Select the project to which you want to place the jar files, right-click the "Export" button
2. Select "java-->runnable JAR file" and click "Next";
3. In the drop-down list under "Launch Configuration", select the main class to run when the program starts;
In the "Export destination" under the "Browse" button to select the storage path of the jar, and enter the jar file name;
If the program relies on other packages, select "Package required libraries into generated JAR" or "Copy required libraries into a sub-fol" at "Library handling" Der next to the generated JAR ", if you choose the latter, when you export, you will copy the required package to a directory, and when you refer to the jar package, it must be copied to the same directory as the jar package.
4. The interpretation of the handling part of the library is as follows:
(1) Extract required libraries into generated JAR. Remove all import jars and include them in each directory of the jar, ex. net/org/xxx.class
(2) Package required libraries into generated JAR. Wrap all the import jars in the root directory of the jar
(3) Copy required libraries into a sub-folder next to the generated JAR. Place all the import jars in a separate folder outside the jar
The Java project in eclipse is exported as a jar file that can be run directly by double-clicking