There is no problem in keeping your Java code, and in idea It is OK to run, then, follow the steps below:
Step one: Open File , Project Structure , artifacts, as
Step Two: Click "+", select "Jar", select Empty or from modules with Dependencies
Step three: Set a main function entry main class
After completing the three steps above, click Finish.
Step four: Come back to the idea main interface, click Build-->build artfacts--build will build the jar file in your project (the generated jar package is located in the set Output directory)
This completes the creation of the jar file and then uses EXE4J to convert the executable jar to an EXE file
Step five: Select a directory, create a new folder, the role of the folder is used to save the generated EXE file directory, in the newly created folder also created three sub-folders File,res,jre such as:
File: folder is to put temporary files can not
Res: folder is put resources files, slices, 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 in the JDK installation directory. With it you can no longer install the Java Runtime Environment
Open exe4j executable EXE interface, directly click Next to get the following interface
Select "JAR in EXE" mode and click on the Next button, such as:
Short name of your application in casual definition
In Output directory, you can specify the directory in which to generate the EXE file, and select the file directory that we just newly created. Then, click on the Next button, such as:
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, which can only be an ico-terminated picture, and then click Next directly, such as:
In VM parameters, enter:-dexe.path=${exe4j_exedir}
You can use him in the program to find the EXE directory, so no matter where the generated EXE can be found in the current directory, usage (String ExePath = System.getproperty ("Exe.path");)
Then click the Plus button, such as:
In archive, select the jar file that we created in the first step, then click the OK button directly
Then click the button after the main class, such as:
Select the program's entry that the program contains the main method class, click the OK button, as shown in:
Then, click on the Next button to appear as:
Enter the version of JRE in minimum version, select Allow JREs with a beta version number, click the Advanced Options button to select Searchsequence such as:
Remove all three options from the box and click the Plus button, such as:
Select the JRE directory in the new file in directory and click the OK button, as shown in:
Then, directly click on the Next button, such as:
Select the client Hotspot VM and click the Next button directly, as shown in:
Select Exe4j splash Screen
Select a picture in the image File and click the Next button, as shown in:
No need to change, directly click on the Next button to 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 generate EXE file complete process.
Using IntelliJ idea to generate an executable jar, convert to exe file step