Java: To bundle or not

Duke WavingIntroduction

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.

Conclusion

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.

The following two tabs change content below.

Victor Ewert

Proprietor/Developer at Ewert Technologies
I am Victor Ewert, a 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, Swift, Privacy and Security, and Mobile App development.

Latest posts by Victor Ewert (see all)

2 thoughts on “Java: To bundle or not

  1. Hi Victor,

    do you know a good step-by-step manual how to bring a java app to the Mac App Store? We tried but it hasn’t worked and some developer told me that it’s not possible to bring a java app to the app store, but following your article it seems possible!?

    Best
    Felix

    • Thanks for you comment Felix,

      To be honest, I haven’t tried to get any of my applications to the Mac App Store; I just create Mac bundles that Mac users can download from my website. If you are trying to get your application on the Mac App Store, there is this article I’ve read: Getting Your Java 8 App in the Mac App Store; it is a little old and applies to JavaFX, but it might be helpful to you.

Leave a Comment

%d bloggers like this: