Make sure that its Java code is not a problem, which is often done in idea, and then. Follow these steps:
Step one: Open File , Project Structure , artifacts, for example,
Step Two: Click "+", select "Jar", select Empty or from modules with Dependencies
Step three: Set a main function entry main class
After the above three steps, click Finish.
Step four: Come back to the idea main interface. Click Build-->build artfacts-build will generate the jar file in your project (the generated jar package is located in the Output of the set Directory)
This completes the jar file generation, then uses EXE4J to convert the runnable file jar to exe file
Step five: Select a directory, create a new directory, the role of the directory is used to save the generated EXE file directory, in the newly created directory also created three subdirectories File,res,jre for example:
File: Directory is a temporary file can not
Res: The directory is where the resource files are placed. configuration files, etc. can also not
JRE: This is required, and the contents of the file can be copied directly to the contents of the JRE under the installation JDK folder. With the ability to install the Java Execution Environment
Open the exe4j can run EXE interface, directly click Next to get the following interface
Select "JAR in EXE" mode. Click Nextbutton, for example to:
Short name of your application in casual definition
The folder in Output directory is used to specify which EXE files are generated. Select the file folder that we just newly created.
And then. Click Nextbutton, for example to:
Enter the name of the EXE file to be generated in executable name
Select the icon file to select the icons that generate the EXE file. The icon type can only be an ico-terminated picture, and then click Next directly, for example:
In VM parameters, enter:-dexe.path=${exe4j_exedir}
Can use him in the program to find the Exe folder, so that no matter where the generated EXE can find the current folder, using the method (String ExePath = System.getproperty ("Exe.path");)
Then click the Plus button. For example, with:
In archive, select the jar file that we generated in the first step. Then directly click on OKButton
Then click the button after the main class, for example:
Select the program's entry is the program contains the main method of the class, click OKButton can. For example, as seen in:
Then, click Nextbutton, which appears for example to:
Enter the version number of the JRE in minimum version, and select Allow JREs with a beta version. Click on the Advanced Options button to select Searchsequence For example:
Remove all three options in the box and click on the plus button, for example:
Select the JRE folder in the new file in your directory to do so. Then click OKButton, for example to see:
Then, click Nextbutton directly, for example to:
Select the client Hotspot VM and click Nextbutton directly, for example, as you can see:
Select Exe4j splash Screen
Select any image in the image File, and then click Nextbutton. For example, as seen in:
No need to change, directly click Nextbutton, you can complete the EXE file generation, the following interface appears:
Then click the click here to start the application launch the generated EXE file and then exit the software.
To this, exe4j generates an EXE record for the entire process to complete.
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Using IntelliJ idea to generate executable jar, switch exe file step