Eclipse Export jar, then convert to EXE executable program

Source: Internet
Author: User

Turn from: 8227876 If you just want to know how to convert the jar to EXE, look directly at the fourth step.
First, export the jar file:

Select your project---then right-click on the pop-up options list---Select Export---Java---jar file---Next---browser (choose the storage path for the jar)---next---next (whichever is too much to continue the next step)--- Browser (choose your program's main class--OK)---finish;

Second, run the jar file:

The generated jar file you can double-click to run it, but by default will be opened as a compressed package, if this is not the result you want, right-click the file---Open mode---Select Java (TM) platform to run.

C. Export to the jar file together with a third-party file:

If you use the API or other ancillary resources provided by the third party during the development of the program, you must export the files of the third party when you export the generated jar files, or your program will not run to the desired results.

You can use the Fat jar plugin to generate the Jar,fat jar: http://sourceforge.net/projects/fjep/downloaded file is Net.sf.fjep.fatjar_0.0.31.zip, After decompression you will see the Net.sf.fjep.fatjar_0.0.31.jar file in the Plugins folder (called The Fat Jar).

Plug-in installation: Copy the Fat jar file to the plugins in your Eclipse directory. Restart your Eclipse platform and look at window---preferences, with the Fat jar preferences in the pop-up window indicating that you have successfully installed, without which the installation was unsuccessful. Take a few more steps: Go to the configuration---org.eclipse.update in your eclipse directory, delete the Platform.xml file, and then restart Eclipse. View Window---Preferences , you will find the Fat jar preferences this item. Congratulations on your installation success. (not successful can go directly to the wall to die).

Package with Fat jar: Right-click on your project, the option list has the build Fat jar item, select it, pop-up window you will feel particularly friendly, easy to use at a glance, click Browser (Main-class choose your main Class)---next---finish ( Tick all the resources you need to pack together, by default. Look, the jar file is generated in your project. Run it, everything goes well, otherwise you are programming the problem.

Another: If you don't want to pack a fat jar, there's a quicker way to help you, but it's also flawed.

Steps: Place the attached file you need to use in the \lib\ext directory in your JRE installation directory (the JRE is installed at the same time as the JDK is installed), and then generate the jar by (one, export the jar file). That's it. It has a fatal disadvantage, Such a jar file can only be used in your native computer, if you want to run on another machine it is necessary to place the same subordinate resources in \lib\ext.

D. Convert the jar file to exe executable file:

EXE file is easy to use, but also can improve the source code and resource security, but also lost the original intention of Java-cross-platform.

If you insist on converting to an EXE file, proceed as follows:

With exe4j This software,: http://www.ej-technologies.com/download/exe4j/files.html, after downloading the installation, run it, and then follow the steps:

1. Click Next directly after running.
2. Select the second "JAR in EXE mode" and click Next.

3. In the general---the short name of your application box, enter the name of your application (whatever you want), enter the save path after generating EXE in the directories---Output directory box. Then next.

4. Enter the name of the EXE that will be generated in the Excutable name box and continue to next.

5. You must first configure the Class-path (click the + sign to add the file, that is, the jar file), if useful to other resources need to add resources together.


6.General---Main class is selected.
7.Java Version---Minimum version (the low version must be filled in), Maximum version (the higher version can be empty), if all are filled then the value of the higher version must be greater than the lower version value. Tick allow JREs with a beta version number as well as only allow JDKs and no jres.

8. Click Finish or always next to finish. This converts the jar to an EXE file. You can click here to Start the application button to test the resulting file.

Is the exe file generated in the directory I selected:

Note: Often the wrong information and solutions

 

Error Hint: Java Virtual machine discovers java_home corrupt, need to reload or define EXE4J java_home configuration to point to a 32-bit JDK or JRE.

The reason is that exe4j automatically generates an executable file that supports 32-bit JVMS while packaging the jar file as an EXE file.

Workaround:

1. If your JVM is 64-bit, in the process of configuring executable EXE files need to be configured to generate 64-bit, be sure to tick the following settings; This is typically because the computer is a 64-bit system,

So installed 64-bit JRE, packaging EXE need to install 64-bit exe4j software, packaging generated executable file should also be 64-bit.

2. If your JVM is 32-bit, you do not need to configure the executable EXE file to generate 64-bit, that is, do not need to tick the following settings, this is generally because the computer is a 32-bit system,

So installed 32-bit JRE, packaging EXE need to install 32-bit exe4j software, packaging generated executable file should also be 32-bit.

Step back to step fourth and click Advanced Options

Click 32-bit or 64-bit

Check the box and click Next.

Eclipse Export jar, then convert to EXE executable program

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.