Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed a JRE in a Windows executable?

Suppose I want to distribute a Java application.

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

Now suppose I want to distribute it as an .exe file on Windows. That's easy enough, given the nice tools out there (such as Launch4j and the likes).

But suppose now that I also don't want to depend on the end user having the right JRE (or any JRE at all for that matter) installed. I want to distribute a JRE with my app, and my app should run on this JRE. It's easy enough to create a Windows installer executable, and embed a folder with all necessary JRE files in it. But then I'm distributing an installer and not a single-file app.

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

like image 354
perp Avatar asked Feb 13 '10 20:02

perp


People also ask

What is Jre Windows exe?

jre.exe is a legitimate file. This process is known as Java Runtime Environment. It belongs to Java(TM) Platform and was developed by Sun Microsystem. It is commonly stored in C:\Program files.

Where is Jre exe located?

The JRE Installer is located on the Java SE Runtime Environment 9 Downloads page. In a browser, go to the Java SE Runtime Environment 9 Downloads page.

Can Java exe run without JRE?

You cannot do without JRE.


1 Answers

Try to use Avian and ProGuard toolkits. Avian allows to embed lightweight virtual machine in you app. Linux, MacOS, Windows and iOS are supported. And ProGuard allows you to shrink large jar file to prepare to embed.

like image 66
i_home Avatar answered Oct 12 '22 01:10

i_home