Article From:https://www.cnblogs.com/LiuYanYGZ/p/9060315.html
Original excerpt: https://blog.csdn.net/uikoo9/article/details/7458666

Comparison of several jar exe methods

【Preface]

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.

 

【Explanation]

Several methods have been tried,

But it’s a little unsuccessful.

Maybe I have a problem with my operation.

 

【jsmooth】

The first jarToexe software for contact,

The reference of this article:

http://hi.baidu.com/chenzhiyanczy/blog/item/070a0f04f9da6308738b6514.html

Feel:

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.

Principle:

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

 

【exe4j 】

Reference articles:

http://www.blogjava.net/huliqing/archive/2008/04/18/193907.html

Feel:

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

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

Principle:

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

 

【Inno Setup】

Reference articles:

Ditto。

Feel:

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.

 

【GreenJVMMake】

Reference articles:

http://blog.csdn.net/cping1982/article/details/2892844

Feel:

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.

Principle:

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

 

【JavaApplication custom factory]

Reference articles:

http://www.2cto.com/kf/201112/113906.html

Feel:

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.

Principle:

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.

 

【Recommended]

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 *