java program can use exe4j to generate exe. The implementation method is as follows:
1. First publish your program into a jar file
Publish java How to package a program into a jar file: How to package a java program
Convert the jar file to an exe file
1. The previously generated jar file , the following is the created directory structure
2. If you use it for the first time, you don’t need to worry about it. Click next
If you have saved the output configuration after use , you can choose open configuration
3. Enter Project type, select "JRA IN EXE" mode, click next
to display Application info
Fill in the program name in the upper box, select the output path in the lower box
4. Configure executableGUI application-->Check allow, fill in the file name in the lower box, icon file You can choose the icon file yourself. If you are restricted to opening only one program at the same time, check allow only a single. The other basic defaults are the default. If your exe4j and jdk have different digits, remember to check 32bit or 64bit in advanced options, otherwise the exe will be generated without error. It also cannot run correctly
5. Java invocation, click the green plus sign on the right side of the Class path box
and write the path of the jar file you generated into Archive ( All external jar packages used must also be added)
Then select the class containing the main method in the main class from box below
6, Minimum and Maximum Fill in the minimum and maximum jdk version numbers allowed Configure search sequence option. Only Search Windows registry
should be kept in the box. If not, add the green arrow on the right. After deleting the others, add the green arrow Directory
7. Find the jre we copied to the folder when we started, click finish
, and then the generated exe file will appear on the desktop.
For more java knowledge, please pay attention to the java basic tutorial column.
The above is the detailed content of How to generate exe from java program. For more information, please follow other related articles on the PHP Chinese website!