How to encapsulate a Java program into an EXE file

Source: Internet
Author: User
Tags microsoft website

You can make a common Java program into a real EXE, that is, a single EXE can be run on a machine without JVM installation. Common tools such as jet and gcj. The former is charged, and the EXE still requires a bunch of DLL. We recommend that you use gcj. For Windows and Linux versions, you can directly download the zip package without installing it. There are many examples, some build batch files. In principle, gcj implements the JVM specification by itself, that is, you write a helloworld. Java, where the main method is system. Out. println ("foo ");
When you use gcj To Make It EXE (about 2 m), running this exe will start a small JVM in it and run helloworld on it.
In fact, it is thankless to make Java a pure EXE, with many restrictions and large files.

I prefer the following methods:

. Use tools such as installanywhere to create an EXE installation package
The user can choose to use the JRE on his machine or the JRE in the installation package to run the program
This is a common practice, such as JBuilder.
The advantage is that you do not require the other machine to have JRE installed, and your original program does not need to be modified.
In installanywhere, the compressed JRE is about 8 Mb.

. Make the executable jar, that is, in the manifest file of the META-INF to set the main-class
You can run the command line Java-jar jarfile. Jar. By default, Windows opens *. jar with javaw-jar. Therefore, you can double-click jar on some machines to run it.

. Production of pseudo-exe, which is exactly the same as the actual method, just implement the exe, and call the system's java.exe to run it. Such tools include nativej and exe4j.

In fact, Java is not like VB. Delphi is just a language, but a platform.
Jar is the most commonly used Deployment Unit. It is meaningless to make it an EXE.
1. exe4j.
Note: exe4j can make jar files into EXE files, but it must be supported by JRE. You can also store jar files outside.
Software nature: Shared Software
: Http://www.ej-technologies.com/products/exe4j/overview.html
Ii. JBuilder.
Note: The New version of JBuilder can directly make projects into executable files of various systems, including Windows systems.
Software nature: commercial software
: Omitted. I downloaded it from eMule.
3. nativej.
Note: The function is similar to that of exe4j.
Software nature: Shared Software
: Http://www.dobysoft.com/products/nativej/download.html
4. Excelsior jet.
Note: You can directly create an EXE file for a Java file. In addition to AWT, swing, and third-party graphical interfaces, JRE support is not required (not for java5.0 ).
Software nature: Shared Software
: Http://excelsior-usa.com/home.html
5. jshrink.
Note: You can package the JAR file into the EXE file. It also has the obfuscation function (this is its main function ).
Software nature: Shared Software
: Http://www.e-t.com/jshrink.html
Vi. installanywhere.
Note: The packaging tool is best for Java packaging. It can be packaged into various operating system packages. Including windows.
Software nature: commercial software.
: Http://www.zerog.com/
VII. installshieldx.
Note: similar to installanywhere, but more powerful than installanywhere. Relatively complicated and difficult to get started. I have not learned it yet.
Software nature: commercial software.
: Http://www.installshield.com/

**************************************** **************************************** ***********

 

[Java open-source packaging tool]

Izpack is a Java installation tool that can be used to create some simple installation programs. The created installer can run on Unix-like, MacOS X, windows, and other system platforms.

Use jsmooth to package the prepared jar into exe.

Launch4j is the Windows Local Executable File (.exe) package for Java applications. Provides a local pop-up screen, application icons, JRE search or use the bound JRE, startup failure feedback, passing command line parameters, ant script.

Vainstall is a multi-platform installation program. The software you want to package can be executable Java class, windows. EXE, Linux executable file, or Unix shell file. You can select four installed interfaces: graphic, Xtra, text, or ANSI. Vainstall only requires a small amount of space and does not use any large temporary files. It is also easy to use the anti-installation function.

Toolshed is a small and simple Java installation and production tool.

Antinstaller defines the UI through an XML file and uses ant as the background. So ant can do the same thing.

Freeinstaller can package Java programs into applications on multiple platforms, such as UNIX, Linux, and Windows NT.

This tool uses ant to create executable files on Windows, MacOS X, and UNIX platforms, such as EXE, zip, and jar. Roxes ant tasks is released based on GPL.

Mini installer is a simple class package used to build a Java installer. The entire process is driven by scripts, and the final result is a unique JAR file. You can double-click to execute a wizard-like installation process.

The ant installer Generator tool combines an ant build script with a GUI to package java files into executable jar files. It aims to create a powerful graphical Installation tool from ANT script.

Packlet is a simple installation tool for Java. A packlet is similar to a ZIP or tgz file. It packs an application into a single, decomposed compressed file. The packlet file can be run on any machine with the Java 2 Runtime Environment installed.

Java service Wrapper can install Java applications into a Windows NT Service or Unix daemon. it also provides the logging function, flexible configuration, reliable running performance, restart as needed, and simplifies application installation,

Autojar helps you create the smallest JAR file from different inputs (such as your own classes and external documents. It recursively searches for the associated classes based on bytecode from one or more given classes, and then extracts these classes from the input file, and copy them to the output. the final document will only contain the actually needed classes. therefore, the applet size can be maintained, the loading time of the applet can be reduced, or the application can be independent from a third-party class library.

Mjar (managed jar framework) Java software distribution/packaging framework. It allows concurrent deployment of classloader separated applications in the same VM. Mjar uses the Spring framework to manage internal components.

 

**************************************** **************************************** ************

To generate executable files in Java requires the support of third-party software, but it is impossible to run Java programs on machines without JDK installed, even if it is compiled into an EXE file.

Several Methods for locally compiling Java applications into EXE (Jove and jet are recommended)
1. Get a towerj compiler from www.towerj.com, which can load your class file
Compile it into an EXE file.
2. Use Microsoft SDK-Java 4.0's jexegen.exe to create the EXE file. This software can
Download from Microsoft website for free:
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]
3. Visual cafe provides a local compiler that can create an EXE file. You need to install the CD
.
4. Use installanywhere to create an installation disk.
5. Use a high-performance Java compiler provided by IBM alphaWorks.
Address acquisition:
Http://www.alphaworks.ibm.com/tech/hpc
6. Jet is an excellent local compiler for Java. This compiler can obtain
Test version:
Http://www.excelsior-usa.com/jet.html
7. Jove of instantiations
Http://www.instantiations.com/jove/...ejovesystem.htm
Jove combines the previous supercede, an excellent local compiler, And now supercede
It no longer exists.
8. jtoexe
Bravo Zulu Consulting, a local compiler developed by INC, could have been
The webpage can be downloaded for free, but cannot be found on the company's homepage.

**************************************** **************************************** ***********

I have read the gay article "several methods for making Java programs into EXE files", which is well written. However, this article was completed earlier and many contents are no longer suitable. I will add a few more here:
1. exe4j.
Note: exe4j can make jar files into EXE files, but it must be supported by JRE. You can also store jar files outside.
Software nature: Shared Software
: Http://www.ej-technologies.com/products/exe4j/overview.html
Ii. JBuilder.
Note: The New version of JBuilder can directly make projects into executable files of various systems, including Windows systems.
Software nature: commercial software
: Omitted. I downloaded it from eMule.
3. nativej.
Note: The function is similar to that of exe4j.
Software nature: Shared Software
: Http://www.dobysoft.com/products/nativej/download.html
4. Excelsior jet.
Note: You can directly create an EXE file for a Java file. In addition to AWT, swing, and third-party graphical interfaces, JRE support is not required (not for java5.0 ).
Software nature: Shared Software
: Http://excelsior-usa.com/home.html
5. jshrink.
Note: You can package the JAR file into the EXE file. It also has the obfuscation function (this is its main function ).
Software nature: Shared Software
: Http://www.e-t.com/jshrink.html
Vi. installanywhere.
Note: The packaging tool is best for Java packaging. It can be packaged into various operating system packages. Including windows.
Software nature: commercial software.
: Http://www.zerog.com/
VII. installshieldx.
Note: similar to installanywhere, but more powerful than installanywhere. Relatively complicated and difficult to get started. I have not learned it yet.
Software nature: commercial software.
: Http://www.installshield.com/

Related Article

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.