Use exe4j to package Java programs and exe4j to package java
Tools:
- Exe4j software (cloud disk storage)
- Jar packages of Java programs that can be run
Open the exe4j software we have installed. First, we can see a welcome interface. We can directly [next;
- 2
In step 2, select "JAR in EXE mode" and then "next ];
In step 3, you need to enter the abbreviated name of the program and specify the output directory, that is, the directory for saving the program. We can set it according to our own situation, without special requirements, and then [next ];
In step 4, we need to specify the program name and set the program icon. Note that the program icon should use an image in ico format;
In the left-side Navigation Pane, select 32-bit or 64-bit and check Generate 64-bit executeable. Check this option to avoid unnecessary troubles. Then [next ];
In step 5, we need to add our jar package, click the green "+" on the right, select Archive, open the browsing directory, and find our jar package, then select Open and OK ];
We can see that our jar package has been added;
Then select the Main class. After the Main class, select Browse, find our Main class, add the master class, and then click next ];
In step 6, set the minimum and maximum versions of JRE. We can set it as needed. Set the minor version to 1.5 and the major version to 1.7;
Click Advanced Options and select Search sequence to add our JRE to the software. In this way, our code can be run on a computer without a Java environment installed; click Add on the right, select Directory, and then click browse. Find Our JRE and add it;
Click [Preferred VM] on the left, select [Client hotspot VM], and then [next ];
The other steps are OK by default, so that the generated exe file can run normally!
Error:
Select a JDK version.
Select a 32-bit JRE file. Otherwise, an error is returned.