Your program development may go easier and faster when you use the latest Java technology. However, that means users of your program must have the same version of the Java Runtime Environment (JRE), or newer, in order to run your program. How do you make sure your program’s user has an appropriate version of the JRE installed on his computer before he tries to run your program?

What Minimum Version Should You Require?

In a moment I’ll discuss steps you can take to make sure someone doesn’t try to run your program if he doesn’t have the minimum version of Java installed on his computer. But first, what version of Java should you require as the minimum version?

Suppose you do your program development using the most recent version of Java, but you carefully avoid using any of its new features. Suppose your program could be run with an older version of the JRE, such as Java 1.3. Should your program state and enforce use of Java 1.3 as its minimum JRE version? Sun (now Oracle) recommends always using the most recent version of Java.

I went back and forth on this. I hated to force the user to install a newer version of Java if my program would work fine on the version of Java he already has on his computer. However, it is a poor business practice to claim a program will work in a particular environment if you haven’t actually verified that it will work in that environment. I wasn’t sure if I would very easily be able to test my program on the older version of the JRE.

Finally I decided that the surest way to warrant the quality of my program is to claim whatever version of Java I used to compile, build, and test my program as the minimum version of Java required.  So if I do all my development work with the latest version of Java, that is the version that I state as the minimum version of Java required for my program. Besides, Java technical support is only available for issues found in the latest version of Java.

Require the Minimum Version of Java When the Program Runs

In a prior blog post, Should You Create an .EXE Wrapper for a Java Program, I discussed my favorite free tool for creating an .exe wrapper, jStart32. An .exe wrapper is simply a small program file with an .exe extension that will call another type of program, in this case a Java program, with all the program’s required parameters.

Some of the settings for creating an .exe wrapper using jStart32 include:

  • Minimal Java Version

  • Display when no JRE found

  • Display when JRE version is too low

By setting these options, the program’s exe wrapper won’t run on a computer that does not meet the minimum JRE requirements for the program.

Require the Minimum Version of Java When the Program is Installed

By placing the minimum JRE requirements on the .exe wrapper as stated above, you enforce the requirement only when the user tries to start your program by running the .exe file. But what if he instead tries to start your program by double clicking its executable .jar file? No minimum JRE requirement is checked when the user directly starts an executable .jar file.

To avoid such problems I would recommend that you also make sure the user has the minimum JRE installed on his computer when he installs your program. Your program’s install wizard should verify that Java is installed and that it is the same version that you require, or newer. You could then abort installation of your program if the computer doesn’t meet your minimum Java requirement. This would save the user from installing a program that he cannot use on his computer.

Conclusion

Set your minimum JRE requirement to the version of Java that you used to compile, build, and test your program. Enforce that minimum JRE requirement both when the program is installed and when the program is run.

But what should you do if he doesn’t have the minimum version of Java? The above steps would simply not allow such a user to use your program. It would be even more helpful if you instead helped him get the correct version of Java so he could run your program.  What to consider when setting that up will be the topic of my next blog article.

Related posts:

  1. Should You Create a Windows .EXE Wrapper for Java Programs?
  2. What is Software Deployment?
  3. How To Distribute Java External Jar Files
  4. Welcome to This Little Program Went to Market
  5. Protect Your Program Code – Obfuscate It

About the Author


Comments are closed.

More Do-It-Yourself Java Games

More Do-It-Yourself Java Games: An Introduction to Java Graphics and Event-Driven Programming is the second book of the Do-It-Yourself Java Games series. You'll learn to create windows and dialogs, to add buttons and input fields, to use images and drawings, and to respond to keyboard input and mouse clicks and drags. You'll create 10 more games including several puzzles, a dice game, a word game, and a card game.

This book assumes you either have an understanding of basic Java programming or you have read the first book, Do-It-Yourself Java Games: An Introduction to Java Computer Programming. Read more.

Do-It-Yourself Java Games

Do-It-Yourself Java Games: An Introduction to Java Computer Programming uses a unique "discovery learning" approach to teach computer programming: learn Java programming techniques more by doing Java programming than by reading about them.

Through extensive use of fill-in blanks, with easy one-click access to answers, you will be guided to write complete programs yourself, starting with the first lesson. You'll create puzzle and game programs like Choose An Adventure, Secret Code, Hangman, Crazy Eights, and many more, and discover how, when, and why Java programs are written the way they are. Read more

Step-by-Step Tutorial

Many of the tips, techniques, and tools discussed in this blog are demonstrated in a detailed step-by-step tutorial in the book, This Little Program Went to Market, by Annette Godtland.

The book takes a computer program through the entire process of creating, deploying and distributing a program, then selling and marketing it (or any other product) on the Internet. Read more.