How to determine the minimum JRE version and system requirements for my Java application
Asked Answered
R

1

18

I have written an application in Java using Eclipse IDE and I now need to know the minimum JRE version that is required to run the application! I know that certain methods are only available under later JREs, but I was wondering what the easiest way to find out the highest requirement of my application would be, so any suggestions would be appreciated...

Also whilst I am on the topic of requirements, I would appreciate any advice or methods for determining the minimum system requirements for my software in general - i.e minimum amount of RAM...

Thanks in advance

Rhonarhonchus answered 3/12, 2011 at 14:12 Comment(3)
You know how engineers figure out how much weight a bridge can hold? They drive increasingly heavier trucks over it until it collapses, then they rebuild it. Do that in reverse...start compiling your app with JDK 7 and use earlier JDKs until it won't compile. Same with memory...use less and less until it breaks. Yes, semi tongue-in-cheek :)Raybin
Compilation alone isn't enough - I almost gave that answer as well. Because previous versions of the JDK/JRE might include bugs that aren't in the version you use most of the time, simply compiling doesn't guarantee correct program execution. You really need it to (1) compile and (2) have your entire test suite pass against a given JRE. If you don't have a test suite, supporting old versions of the JRE is going to be WAY more complicated.Cloudburst
@Raybin I kind of suspected that I would receive an answer along those lines from someone, and I guess there's a good reason; it seems that there is no easy way to calculate these requirements. Thank you for your answer Paul, but please see my comments on normalocity's answer, who, I think makes a good point and I agree that may be I should discourage the use of older JREsRhonarhonchus
C
11
  • Method 1: For minimum JRE version, that's going to be tough. The easiest way is to simply require the same version that you're building against, or later, e.g. JRE 6.x.x or higher.
  • Method 2: Install multiple JDK's, making them available in Eclipse, and just change the version you're building against, running your app's test suite each time, and making sure they all pass. The earliest version of the JDK that allows all your tests to pass is the lowest JRE it can run against. Simply having your app successfully compile isn't enough, because previous versions of the JRE/JDK might have bugs that allow for successful compilation, but don't allow for proper program execution.
  • Method 3: Always require the latest on the client side, because Oracle is constantly patching security holes, and ultimately, it may be best to require the latest versions, if you have that kind of control, on the client side.

As far as RAM, that's easy. When the JVM starts it sets a 'maximum' amount of RAM (I believe the default may be 128MB), and that's a hard limit that your application cannot exceed without crashing. Profile your app over time, tweaking the memory settings on the JVM, and find out what the minimum amount of RAM is that you'll need for your app to run both (a) with acceptable performance, and (b) without throwing an OutOfMemoryError, and you're done.

Ref: How to configure JVM options and memory?

For other requirements such as CPU req., things get a little fuzzier. There are a lot of CPUs out there, and the throughput that a given system produces can vary not just based on CPU speed, but the speed of the hard drive, the amount of RAM installed in the system, the speed of the network interface (if you're writing a network app), and other things. For requirements such as that, you'll want to just test it on a variety of systems and sort of draw a line somewhere, and say, "You can expect acceptable performance if you have hardware that is at least as powerful as X, Y, Z".

The other thing you could do is build in a benchmark, or some kind of performance logging, and have that performance data sent back to you. Lots of apps do this. You know that "May we send anonymous usage data back to the mothership?" question you get when installing some software? Well, common among that data are system-specific details such as RAM, CPU, hard drive model, and other hardware details (whatever data you determine is relevant to your app), along with performance logging data. By taking that kind of approach, what you get is a lot of performance data from lots of different system configurations without needing to have a huge number of differently configured machines in-house.

You can do the same thing for program crashes and bugs - have the stack traces, system info, and other relevant data dumped to a log file that is sent back to you - but of course, only if your users have said it's okay to send that data back to you.

Cloudburst answered 3/12, 2011 at 14:21 Comment(3)
Thanks for your answer normalocity, although I'm not quite sure what you mean about the RAM. Do you mean that I should put the minimum requirement for RAM as the minimum requirement for the JRE installed - actually, in theory that should be the same for every requirement!? As for the JRE, I think I'll stick with JRE 6, but always recommend the latest version.]Rhonarhonchus
Yes, I think you've got the RAM question figured out. When you start the JVM, you can specify, "Hey, don't take more than 32 MB of RAM," or any arbitrary amount of RAM that you like. So, run your app multiple times with different minimum values (I provided a link to setting the JVM memory settings), and the smallest value that allows (1) your app to run with acceptable performance, and (2) doesn't crash due to running out of memory, becomes your minimum RAM requirement.Cloudburst
Thanks for that, an interesting and informative insight. I think I've made the conclusion the the minimum JRE version shall be JRE 6 with a minimum RAM requirement of 128MB, seeing as though this is required to install Java anyway, and I do believe that Java will run on Windows 200 and upwards! I can't see much point in investigating those requirements on my application much further if Java needs to be installed anyway, especially because I don't have suitable testing facilities.Rhonarhonchus

© 2022 - 2024 — McMap. All rights reserved.