As every Java application developer knows, in order for your users to use your application, they need a Java Runtime Environment (JRE) on their computer. Traditionally, this was done by providing the user with instructions on how to download and install a JRE (or check if they have he correct JRE), prior to installing your software. In recent years, particularly with the gaining popularity of JavaFX, and because of Mac App Store requirements, the trend has been moving towards bundling a JRE with your application. As a Java developer, I’ve been debating this in my mind, and can see both pros and cons of bundling a JRE.
Pros of bundling a JRE
Bundling a JRE, basically means that your application includes its own JRE, that gets installed, along with your application; typically within the same folder (Windows) or within the app bundle (Mac). The biggest advantage to bundling, is that your users don’t need to worry about installing or managing JREs, and can just use your application. A second advantage is that you can better control which version of the JRE will be used with your application. Additionally, if you want to distribute your Java application on the Mac App Store, it needs to include a bundled JRE.
Cons of bundling a JRE
The biggest con of bundling a JRE, is that users won’t always being most current JRE available, when running your application. Oracle is currently releasing regular updates to Java 8 every 3 months, and so a user that installed your application a year ago, will have an outdated version of Java, and may be missing some important security fixes. The best solution for this is, to release updates your applications, with the latest JRE, every time Oracle makes an update; but this can become a little onerous and time-consuming and there is no guarantee the user will update the application. Another con, is that including a JRE greatly increases the download size of your application; although with current internet speeds this is becoming less of an issue. Finally, bundling a JRE also means the user will have many, possibly redundant, JREs sitting around on their computers. Again, with current hard drive sizes that probably isn’t too much of an issue, but it just doesn’t seem efficient.
I am still sitting on the fence with this, and currently release two version of my apps; one with a bundled JRE and one without. This can also be a pain, and so am considering moving to just bundling in the future. If anyone has any comments, or best practices that they use, I’d love to hear them.
I am Victor Ewert, an Independent Software Developer and owner of Ewert Technologies. In the past I have worked as a Software Tester including working on Software Test automation.
My current technology interests include Java, JavaFX, Kotlin, Swift, Privacy and Security, and Mobile App development.