Introduction to MyEclipse export runnable jar package
This method can simply import third-party jar packages
1. Right click the project, click export = "Java =" and select the third one, runnable jar file and next. 2. Select launch configuration and export destination library handling: select the first referenced jar package and integrate it into the project.
The jar package selected for the second reference will be placed separately in the project root directory (recommended). The jar package selected for the third reference will be placed separately in a folder in the same directory as the exported jar. Finish.
Problems encountered:
Why MyEclipse 8 There is nothing to choose from in the launch configuration of exportc > runnable jar filec > in 5. In fact, it is necessary to run the main method of the project you want to package into a jar file once. For example, if the main method is in class A, run a once
2、 Jar file mode (no third-party package)
If the third-party package is not referenced, the packaging is relatively simple:
1. First open the project in MyEclipse, right-click the project and select "export"; 2. Select Java / jar file, next; 3. In select the resources to export, you can select the project folders you want to include, and some unnecessary folders do not need to be put in, so as not to increase the space; There are several options: * export generated class files and resources means that only generated files are exported Class files and other resource files * export all output folders for checked projects means to export all folders of the selected project * export java source file and resources means that your source code * Java, if you don't want to disclose the source code, don't choose this * export refactorings for checked projects include some reconstructed information files. In select the export destination, select the path of the exported jar, next 4. On the next page, you can choose whether to export *. With warnings or errors Class file. Generally ignore him, next 5 You can configure the project in the next page. (if the project does not introduce a third-party jar package, it is OK if we adopt the system default option, and the main class must be set as the main method entry class of your project) * generate the manifest file is the manifest.mf file automatically generated by the system for us. If your project does not reference other class paths, you can select this option. * use existing mainfest from wo rkspace。 This can be customized MF file, format as written above* Seal content。 To encapsulate the entire jar or the specified package packet * main class. You can select your program entry here. The jar packaged in the future is the execution result of your entry class. Finally, finish
3、 Jar file mode (with third-party package)
Since there is no option to export runnable jar file in MyEclipse (the specific reason is not found), you can only use jar file mode and configure the third-party package after export.
If you can package, you may know manifest MF file. To run a jar, you must set main class in this file: this can be set according to mode 1.
If you want to use a third-party jar package, you also need to set it in this file. You need to add XXX / in front of the following path to this file, which is temporarily called the X directory.
Multiple jars are separated by at least one space.
It should be noted that class path: must be followed by a space, and there must be two spaces at the end of the file, otherwise the file is invalid. (manifest specification is quite dead)
This is not over yet. After setting, set the manifest with main class and class path MF files and class files are packaged into my Jar (arbitrary file name). It should be noted that third-party jar files should not be packaged and typed in.
Take this my Jar is placed in a directory. At the same time, create a new x directory under this directory, copy the jar files of the third party to the X directory, and then return to the previous layer my Jar directory, execute Java - jar my Jar will run successfully.
There is another method that does not need to set manifest MF's class path, which is not recommended, is to copy the third-party jar file to the Java extension class loading path, that is, in% JRE_ Home% / lib / ext directory.
summary
The above is all about the introduction of MyEclipse export runnable jar package in this article. I hope it will be helpful to you. Interested friends can continue to refer to this site: complete code example of red black tree implemented by Java algorithm, detailed explanation of list in Java collection, service number payment code example of Java wechat payment, etc. if you have any questions, you can leave a message at any time. Xiaobian will reply to you in time. Thank you for your support!