After weaving Java into .CLASS, if you only use the java command to perform, you always don't be too interested, find a way to generate the file like an EXE file to double-click the file that can be executed, it should be very interesting. Here I use a name called EXE4J, I feel good.
First of all, of course, it is necessary to download an Exe4j. I am 2.2 version, license: L-G782DN2D-1F1YQXX1RV1SQD.
Then, will you choose to be released. Class files don't have to be said. Here is to create a JAR file. Here I use a name called D: /myjava/test.class to exemplify, and pay attention to write a file manifest.mf that determines main_class, where mainfest.mf and directory myjava are in the same In a directory (here you are d :), then use the following command:
Jar Cvfm Test.jar Manifest.mf Myjava
Manifest.mf didn't know how to write, very crazy. . . Ha ha. In fact, it is very simple, the code is as follows:
Manifest-Version: 1.0main-class: myjava.testcreated-by: Hanic
As long as the main-class is written. In this way, a Test.jar file is generated, here I will not say the specific function of JAR. However, in order to ensure success, we can use the following instructions to execute the Test.jar that has just been generated:
Java -jar Test.jar
How can it be smooth? If so, then we can start the creation of executable files.
EXE4J is quite simple to apply it. Similar to a fool, just all the way next, fill in and selecting individual parameters OK. It can be applied for a little more I understand. Don't say that you don't understand at a point! No way, simply say the process:
1. Open the exe4j, you can enter license, you can open the config file you have previously operated.
2. Click the Next button, select the JAR IN EXE MOD button, click Next.
3, fill in the path of the short name and file output and click Next.
4, here you can choose the type of executable you want to generate, and the generated executable name, the icon of the executable file, etc., we will choose the GUI Application here, the name will take one according to your own needs, icon You can choose one you like in your icon library, then Next.
5, fill in the name of Main Class, click Green Select the desired .jar file, if there is no special requirements, we can continue.
6, next is to select the JRE version, fill in the maximum minimum version of JRE and then continue.
7, let's take a look at your file, add its beautiful effect, choose your favorite picture, write the text you want to write, and adjust the location of the text as needed, continue.
8. The following is a selection language version of the interface to choose after selecting.
9. The following is a short wait, then it is highly gone, and a Java write executable is generated in this way.
10, double click to look at the effect, keep your own start effect, how do you feel?
-------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sorry, it may be issued, the editor will automatically omit "/". . .
For example, you have a Test.class file, under D: / Myjava, then put the manifest.mf in d: / you can. Then in D: / Run, Jar CVFM Test.jar Manifest.mf myjava can generate Test.jar in D: /
Content in manifest.mf:
Manifest-Version: 1.0
Main-class: myjava.test
Created-by: hanic
In fact, only main-class is useful, "create-by: hanic" means the author of this .jar file, here is Hanic, that is, me, huh, huh.
-------------------------------------------------- -------------------------------------------------
Q: Is it possible to run a computer that does not install a JDK?
A: The answer is negative