Hey happy people @ JGO!
I've been looking around a bit for a good answer to this question, but I could not find it. I'd like to follow the prophesy of Cas, whom I quote completely out of context:
we don't care! We just want stuff to work.
Edit: make sure to listen to this
to get in the right mood.
I also want stuff to work, and I don't mind if things are theoretically pure. Now I'm looking for a good way (i.e. one that "works") to deploy a Java game (using LWJGL) as a Windows executable that works whether or not the user has installed a JVM. In other words, I'd like to embed a JVM into an executable, but I'm not sure how to do this.
This is what I do know:The Oracle JRE
According to the Oracle JRE readme
it is perfectly normal to distribute the JRE alongside with your application:
The Java(TM) Platform, Standard Edition Runtime Environment (JRE(TM)), excluding the JavaFX(TM) runtime, is intended for software developers and vendors to redistribute with their applications.
I presume this is also true when I embed the JRE inside my executable. (after all, it's not much different from distributing it in a ZIP file)How to make it small
Also in the JRE readme
is a list of files that can be excluded. When I strip away most of these files, the JRE is still (compressed) 24MB. While that's not a huge problem, I'd like to reduce it in size further. One thing I'm thinking of is to keep on stripping stuff out until my game no longer works.. How would you guys do this?
Here's what I found so far:
The embedding process
- Remove the optional files listed in the JRE readme (make sure to also remove the files that are used for the browser plugins).
- Compress the rt.jar runtime library as described in this Oracle blog post.
- Use an alternative JVM that has a small footprint, e.g. JamVM. As far as I understand, this may have severe performance implications however.
What tools can be used to embed a JRE? I know that launch4j
has an "embed JRE" function, but I'm not sure what else is out there. What tools or approaches are best when embedding a JRE?