Embed a JRE in a Windows executable?

Posted by perp on Stack Overflow See other posts from Stack Overflow or by perp
Published on 2010-02-13T20:28:59Z Indexed on 2010/04/26 11:43 UTC
Read the original article Hit count: 307

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)?

© Stack Overflow or respective owner

Related posts about java

Related posts about Windows