Jar-to-exe and exe installation packages, including the java environment, jarjava

Source: Internet
Author: User

Jar-to-exe and exe installation packages, including the java environment, jarjava

It is really difficult to start a name that can summarize all the content of this blog.


What a magic language Java is, it can be called a Learning application.

Java can be used to develop mobile PC Desktop Server Web Front-end programs

Java has developed well in the other three fields, but almost no one is using PC Desktop. Why?


The reason is simple. The Java leader's mind is swallowed up by botnets.

To give a simple example, I used Eclipse to export a Runable Jar to the desktop. Double-click the Jar file and the Jar file cannot be executed.

To be honest, I have been here for more than half a year before I knew that I would use the Windows command line to execute java-jar xxx to start this executable jar program, when installing JDK, why not use the default program for jar execution? If no executable class exists, a dialog box is displayed, in this way, at least I can easily create a jar program that can be executed in Windows, or JDK that contains a tool to package jar into exe.


After my research, it is not feasible to convert Jar to exe. I need to use several third-party tools. Here I will broadcast the whole process of making a jar package into a Windows Installation Package (including jre:

Preparation tools:

  • 1.7Zip click to open link http://pan.baidu.com/s/1mg1d0Ru
  • 2.exe 4j click to open the link http://pan.baidu.com/s/1o6DQBEU

Create the jar startup program to solve the jre dependency problem.

  • 3. inno_setup click to open the link http://pan.baidu.com/s/1qW0pvek

Used to create a Windows Installation Package

  • 4. jdk 1.7 32-bit click to open the link http://pan.baidu.com/s/1mgurP00


Step 1: Export jar
  • Install jdk (installed abuse)
  • Right-click eclipse to export Runable jar

Step 2: Create the jar Startup Program. 1. Configure the environment variable of exe4j,

EXE4J_JAVA_HOME executes the bin directory of jre. Note that it is different from the general java environment variable.

2. Decompress exe4j and run exe4j.exe under the bin directory.

If the running fails, try to move it to another disk (the directory path cannot contain Chinese characters), or the environment variables in the first step are not paired.

3.exe:

  • A: You can use the following registration code to register exe4j:

Username and company name can be entered at will
A-XVK258563F-1p4lv7mg7sav
A-XVK209982F-1y0i3h4ywx2h1
A-XVK267351F-dpurrhnyarva


  • B. Configure the path

  • Select the jar to be encapsulated:

  • Configure jre

  • Configure the startup Screen

  • Success:

In this way, the jar startup program is ready. If the startup of the exe fails, I try to change to a 32-bit computer. I cannot run the exe exported by 64win 8.1, and the error code 16 is displayed, I couldn't find the cause. I switched to 32-bit XP, and everything went fine.


Step 3: Create the exe installation package

In this way, the program is a lot of files and folders, And the jre is extracted more than 100 mb. It is obviously not professional for others to use. Let's create an installation package,

The tool used: Inno_setup. As for how to use this tool, if someone is more professional than I write, I will not repeat it. Read the following blog:

Click Open link http://robert-liu.iteye.com/blog/890165

However, when selecting a folder, he will decompress the folder to the root directory. For example, if I select the adb folder, during installation, all files under adb will be decompressed to the installation directory of the program, instead of the installation directory/adb directory. The solution is to manually modify the script, which is very simple, I believe you can understand the following picture:



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.