Java. after the class, if you just use Java commands to execute it, you may not think it is too enjoyable. It is interesting to find a way to generate a file that can be executed by double-clicking with the mouse like an EXE file. This document describes how to generate a Java executable program.
Here I use a free small software called exe4j. It feels good. Next I will explain the process of generating executable files from the java. Class file.
First, select the one you want to release. you don't need to elaborate on the class file. The following is a jar file. Here I use a name named test. for example, write a file manifest to determine main_class. mf, Here mainfest. MF and test. class is in the same directory, and then use the following command
Jar cvfm test. Jar manifest. MF Test
In this way, a test. jar file is generated. Here I will not elaborate on the specific functions of jar. But to ensure the success, we can use the following command to execute the generated test. jar:
Java-jar test. Jar
How can we proceed smoothly? If yes, we can start creating executable files.
Next, open exe4j. Its first interface is as follows:
Click the next key, select the "jar in EXE" Mod button, and click Next;
The following figure is displayed. Enter the short name and file output path, and click Next to continue.
You will see the following figure. Here you can select the type of the executable file you want to generate, the name of the generated executable file, and the icon of the executable file, here we will select the GUI application, and the name will be set according to your own needs. You can select an icon you like in your icon library, and then click Next to continue;
The next screen is as follows. Enter the name of main class here and click green + below to select the required. jar file. If there are no special requirements, we can continue;
The next step is to select the version screen, fill in your maximum and minimum versions, and then continue
The following figure will help you set the title of your file execution to improve its aesthetic effect, select your favorite image, and write the text you want to write, you can adjust the text position as needed before proceeding.
The following is an interface for selecting the language version.
Below is a short wait,
Then, it is done. an executable file written in Java is generated in this way.
Double-click it to see the effect. What is the starting effect set by myself? what is it like?