Article From:
Original excerpt:

Comparison of several jar exe methods


I did this one day today, speechless and in a terrible state.

In fact, the advantage of Java is not on the application,

Want to compile software C what.



Several methods have been tried,

But it’s a little unsuccessful.

Maybe I have a problem with my operation.



The first jarToexe software for contact,

The reference of this article:


An independent EXE file can be generated,

But it can’t run on a machine without JRE.

The bundling JVM described in this article has not been realized.


Ponder, like, push jar into exe, and tell the computer JVM where it is.


【exe4j 】

Reference articles:


Finally, a folder is generated, including JRE, jar, exe.

exeThe file must not leave this folder or it will not work.


It’s supposed to tell the computer where jar is and where JVM is.


【Inno Setup】

Reference articles:



That is to create a package of exe4j generated folder.

And then install it through this installation package.

It’s fun, but it’s not realistic.

There is a JRE in one of the installation packages, so it’s very big.



Reference articles:


From above you can see that the size of jar to exe is directly related to JRE.

So we think about reducing the size of JRE,

After thinking for a long time, I found nine basically useful rt.jar.

So we are going to streamline rt.jar and use this software to do it.

When you do it, you will make a mistake with exe4j.

The scheme given in this paper is similar to exe4j + Inno Setup.

But to this step:

No way, we make a small program that calls the pack library completely, and then create a rt.jar that only relies on the library, and merge it into a custom rt.jar and run the program again. OK, it’s passed.

I don’t know what the pack class library is, so I can’t go on with it.


Streamline JRE, then put JRE and jar together, and tell exe where jar and JVM are.


【JavaApplication custom factory]

Reference articles:


It’s a lot better than the GreenJVMMake above.

The functions are: Streamline JRE, and simplify JRE and jar to generate exe.

There are two types of simplification.

First, it only contains classes used in runtime, which is very small after JRE.

The other is the class that runs and the classes it relies on, which is slightly larger after JRE, but with fewer errors.


Streamline the JRE, then put JRE and jar in a folder, generate exe, and tell the computer where jar and JVM are.

exeYou can’t get out of this folder, too.



If you want to put your own jar program on other computers without JRE, you can use them.

Recommend this way: Java application custom factory + Inno Setup

Leave a Reply

Your email address will not be published. Required fields are marked *