10 methods for converting a Java program into an EXE file

Source: Internet
Author: User

Compare several Java-to-EXE tools and share your views:

1. Get a towerj compiler from www.towerj.com, which can compile your class file into an EXE file.
Note: I can't find it now. If I don't provide it, I will be acquired by someone else.

2. Use Microsoft SDK-Java 4.0's jexegen.exe to create an EXE file. This software can be downloaded free of charge from Microsoft's website:
Http://www.microsoft.com/java/download/dl_sdk40.htm

The jexegen syntax is as follows:

Jexegen/out: exe_file_name
/Main: main_class_name main_class_file_name.class
[And other classes]

Note: I have not tried it.

3. Visual cafe provides a local compiler that can create an EXE file. You need to install the EXE component provided on the CD.
Note: I have not tried it.

4. Use installanywhere to create an installation disk.
Note: It is a good tool.
But it must be larger than 8 m (with JRE), and 1 m (without JRE ).
However, it can be compiled into EXE programs available on various platforms.

5. Use a high-performance Java compiler provided by IBM alphaWorks, which can be obtained from the following address:
Http://www.alphaworks.ibm.com/tech/hpc

Note: I have not tried it.

6. Jet is an excellent local compiler for Java. The compiler can obtain a test version from this website:
Http://www.excelsior-usa.com/jet.html

Note: Do not like it.
The compiled program is still JRE. I heard that JRE is not supported for genuine programs. It takes 30 minutes to compile after installation.

7. Jove of instantiations
Http://www.instantiations.com/jove/...ejovesystem.htm
Jove combines the previous supercede, an excellent local compiler, And now supercede no longer exists.

Note: Too annoying. A dialog box always comes out.
A dialog box is displayed, indicating that this is a product of Jove.

8. jtoexe
Bravo Zulu Consulting, a local compiler developed by INC, could have been downloaded from the company's webpage for free, but cannot be found on the company's homepage at present.
Home: http://www.bravozulu.com/
I have had this software on the FTP below. I don't know if it is still there:
Ftp://race.dlut.edu.cn/pub/java/tools/jet

Note: It's annoying. I always come up with a dialog box, but I didn't think I found crack and found it on Google.
Now that the dialog box is removed, I like this tool very much. Although it requires JRE, the file is only over 100 kb, which is good.

9. exe4j
Very good

10. JBuilder
This tool does not need to be discussed much. In jbuilder6.0 or earlier (including 6.0), the EXE file cannot be generated, so you can implement it using the following method. This is something someone else can think of. I just want to publicize it.
In addition, both jbuilder7.0 and later versions can generate EXE files.

This is Borland's non-public usage technique. It can use JBuilder to create EXE files to start java files.
JBuilder does not support local compilation. However, there is a hidden technique that allows you to start a Java program from an executable file, which can appear or does not appear in the console window. To do this, you need these files in the bin directory of JBuilder:
Jbuilder.exe
Jbuilderw.exe (optional)
JBuilder. config
JDK. config
Javalauncher. dll
Container, but the console window is not displayed during running. The key to using these files is the file name. “Jbuilder.exe "searches for a configuration file named" JBuilder. config ", which contains the required information for running Java programs. In the same example, jbuildercmdexe‑ jbuilder.exe "is used to start Java programs without the console window. If you rename jbuilder.exe to "foo ",
Hosts file.
In this case, the intelligent reader should guess how to use jbuilder.exe to start the application. (Or the renamed EXE file) to start the Java application. The following uses the local machine as an example.
Borland JBuilder 5 is installed in the E:/jbuilder5/directory, and a tempdirectory is created under E:/jbuilder5/bin/. Then, jbuilder.exe and JBuilder are created. config, javalauncher. DLL, JDK. copy the four files in config to the E:/jbuilder5/bin/temp/directory, create a hello directory under the directory, and generate a hello. java file, that is, E:/jbuilder5/bin/temp/Hello/hello. java file,
// Hello. Java/
Package hello;
Public class Hello {
Public static void main (string s []) {
System. Out. println ("Hello, EXE file! ");
}
}
Compile it into a class file, open the JBuilder. config file, and modify the file accordingly:
Find the following two lines in JBuilder. config:
# Start JBuilder using the its main class
Mainclass com. Borland. JBuilder. JBuilder
Change
# Start JBuilder using the its main class
Mainclass hello. Hello
Addpath E:/jbuilder5/bin/temp/
The addpath command adds the directory to the class path. The commands that can be identified by other config can be found in config_readme.txt in the JBuilder/bindirectory.
Then modify the javapath in JDK. config to a relative path. For example
Javapath ../jdk1.3/bin/Java
Modify
Javapath.../../jdk1.3/bin/Java
Last
Modify jbuilder.exeand jbuilder.configto the corresponding file name, for example, foo.exe and foo. config.
Run the foo.exe file.
So far, modifying JBuilder to use the EXE file to start your Java application has been completed.
But the fun part is not here. The following tips may be more interesting. Package the JAR file into the EXE file!
Assume that the hello. jar package is generated using the above file,
Jar CVF hello. Jar Hello/*. Class
Then, add the jarpackage to the end of jbuilder.exe,
Copy/B ../jbuilder.exe + hello. Jar foo.exe
In the foo. config (JBuilder. config) file, remove the previously added class path and add the following path:
Addpath E:/jbuilder5/bin/temp/foo.exe
Then, foo.exe
Have you seen it? An EXE file containing a jar package is executed!
The general principle of this process is: the important information of the EXE file is in the file header, so it doesn't matter to put the mess at the end of the EXE file; the important information of JAR/ZIP files is at the end of the file, so that they are irrelevant and can be easily executed.
Note: If you use this function, you have to take on the possible risks, Because Borland does not provide official support for this function!

You can also go to the notebook.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.