Embed JRE in Windows executable?

Suppose I want to distribute a Java application.

Suppose I want to distribute it as a single executable file. I could easily create .jar with both the application and all its external dependencies in one file (with some Ant hacking).

Now suppose I want to distribute it as a .exe file on Windows. This is easy enough, given the good tools out there (like Launch4j, etc.).

But suppose now that I also do not want to depend on the end user having the correct JRE (or any JRE at all, for that matter). I want to distribute the JRE with my application, and my application should run on this JRE. It is simple enough to create an executable file of the Windows installer and insert into it a folder with all the necessary JRE files. But then I distribute the installer , not the single-file application.

Is there a way to embed both the application and the JRE into a .exe file that performs the function of launching the application (and not as an installer)?

+54
java windows software-distribution executable deployment
Feb 13 '10 at 20:28
source share
11 answers

Try using the Avian and ProGuard tools. Avian lets you embed a lightweight virtual machine in you. Linux, MacOS, Windows, and iOS are supported. And ProGuard allows you to compress a large jar file to prepare for embedding.

+22
Jul 19 '12 at 8:11
source share

A new tool will appear that does this: Packr
https://github.com/libgdx/packr

+9
Jul 21 '14 at 9:43
source share

Quite a lot of options, commercially this is very good:

http://www.excelsior-usa.com/jet.html

There are two open source keys GCJ and VMKit

http://gcc.gnu.org/java/ and http://vmkit.llvm.org/ p>

Other longer paths include IKVM.NET:

http://www.ikvm.net/

What is a .NET JVM that can be statically compiled into EXE

+7
Feb 13 '10 at
source share

Is there a way to embed both the application and the JRE into a .exe file acting as a launch application (and not as an installer)?

If a commercial tool is right for you, install4j solves this problem very smoothly (see its Features page ). It can generate both programs to launch and install applications .

I would love to repeat too much, so check for example. this is an earlier answer where I hooked it up (as an installation installer, but there are not many here).

Synopsis / summary line: install4j can create its own .exe-launchers, which are absolutely independent of the pre-installed JRE (or any other specific libraries), and offers flexible options for grouping (and detecting) the JRE.

+4
Feb 13 '10 at 20:32
source share

Netbeans allows the Java SE project to be packaged into an embedded application installer by deploying the JRE. Here: https://netbeans.org/kb/docs/java/native_pkg.html :)

+3
Nov 23 '14 at 17:22
source share

I know that I'm a little late for this party, but it seems that ej-technologies (I love their stuff) has a new solution called exe4j that will do the same thing as OP without any funny business.

http://www.ej-technologies.com/products/exe4j/overview.html

If you work in an OpenSource project, they provide free licenses (you just need to contact them). If this is a commercial project, then a license is required ... but at a price of 69 US dollars per license, it is cheap and costs while imho.

On its website:

 If you want your own process name instead of java.exe in the task manager and a user friendly task-bar grouping, exe4j does the job for you. exe4j helps you with starting your Java applications in a safe way, displaying native splash screens, detecting or distributing suitable JREs and JDKs, startup error handling and much more. 
+1
Aug 08 '13 at 15:21
source share

JSmooth can do this according to the documentation. I only tried this without the built-in JRE, but was very pleased. This is a script with ant, and we are building on Linux.

http://jsmooth.sourceforge.net/features.php

0
Feb 13 '10 at 20:35
source share

You can take a look at: http://ulibgcj.sourceforge.net/uswt.html It has a micro-swt library that simplifies GUI compilation using SWT and take a look at the Eclipse GCJ Builder

0
Nov 24 '11 at 11:50
source share

Install4j is a great tool for this breaking point. You can also check JSmooth or launch4j-everything, although I tried to connect jres with JSmooth and could not ...

0
Jun 08 2018-12-12T00:
source share

I found an Engima x86 / x64 projector better than a BoxedApp packer

If you get soft miminizejre by packr, than copy myapp.jar application to launcher \ jre \ bin \

and copy from the installed example jre C: \ Program Files \ Files \ Java \ 1.8.0_xxx \ bin \ javaw.exe to launcher \ jre \ bin \

Login for entering Open Engima -> javaw.exe from running \ jre \ bin \

And go to Options if you need a high compress and Find Miscellaneous → Command line "-jar myapp.jar"

And click "protect" and wait for all dll and jar in exe

Make sure your myapp.jar should generate Eclipse using the “Required Package Libraries in the Generated JAR” because you don’t worry if you have imported many sample lwjgl or JavaFX libraries, than you should check if the built-in javaw_protected.exe includes important files .

But the BoxedApp Packer is the same as the BoxedApp Packer, slightly larger than the Engima Protector. Protector is almost the best javaw.exe investment with assets / resources. Than they cannot crack jar files ... I hope you are happy with your own bank in exe, since it is less than 4 mb without the lib directory. If you have a problem with the jvm.cfg error message, it means that you are not copying the built-in exe to the root directory of jre or jdk

Please make sure that the embedded exe is outside the root directory of jre or jdk.

Hope you have no problem if you are using Protector x86, than you need to use i586, Protector x64 for jre x64

If you use Protector x64 with jre x86 / i386 - this is normal, the problem. It works great.

Regards

// EDIT:

UPDATED NEW VERSION EXCELSIOR JET + VIRTUAL BOX OR PROTECTOR - these are almost the best "built-in applications"

Check out youtube: https://www.youtube.com/watch?v=ctbIxq-1MGE

0
Oct. 14 '16 at 21:53
source share



All Articles