Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: How to find out the minimum JRE requirement for my Java program

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to find out the minimum JRE requirement for my Java program

    I finished a game in Java and sent it to a friend.

    Launching the program in my computer worked just fine.

    But he got this error:
    "Could not find the main classs: Main. program will exit"

    My JRE version is the most updated one. His JRE was version 1.6.

    He updated his JRE, and the problem was solved.

    This is a bit worrying for me, because as far as I know, 1.6 isn't a very old version of the JRE. It's not the most recent one, but not that old.

    This is worrying because I'm planning on sending my game to a lot of friends, and trying to distribute it on the internet.

    A lot of people don't have the most updated JRE. And they are mostly non-programmers, so I can't expect them to update to the newest version of Java upon downloading my game. They might not know what Java is, even though they got it on their computer, and upon receiving an error, they'll just give up on the game.

    If my game wouldn't work with a significantly old JRE, that would be reasonable. It's part of the nature of working with Java. But the fact that a relatively updated JRE, 1.6, doesn't work with my game, is worrying.

    *(Please note: My game isn't implementing anything "special". Swing and KeyBindings are the 'newest' additions to Java that I can think of inside my game)*.

    In short, I'd like to know that my game works on most of the computers it tries to run on. Knowing that it doesn't work on a relatively new JRE, is worrying.

    So I have two questions:

    1. Is it normal, for a Java program, to have such "high" demands for
    the JRE version? Do a lot of Java games demand at least version 1.6
    of the JRE? Is this common?

    2. How can I find out the minimum JRE version requirement for my
    program? Is there a methodical way to do this, or do I just have to
    go through all the libraries I use in my game and figure out what's
    the JRE release version for each one?

    Thanks a lot


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to find out the minimum JRE requirement for my Java program

    1. The programmer determines the JRE required and the backwards compatibility of his/her programs by choosing the compiler compliance level (Eclipse's wording) for the project. Even if the programmer has 1.7 of the JDK installed, the compiler compliance level can be set to a lower level or previous version.

    2. If you have 1.7 of the SDK installed and compiled your project from the command line using default settings, you can assume that the finished product requires JRE 1.7 to run correctly. There are command line switches to specify the compiler compliance level, and you can find those by searching for javac command line switches. If you use an IDE, the compiler compliance level should be set for the project. You can recompile your project at a reduced compiler compliance level for your friends as needed, or choose a reasonably low level that you think will be suitable for all.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to find out the minimum JRE requirement for my Java program

    GregBrannon - Thanks for your help. I am using Eclipse.

    So basically, you're saying that the default for Eclipse is to set the minimum JRE requirement for the application, based on the JDK I had installed when programming. Did I understand correctly?

    If so: If I programmed using JDK 1.7, and I want the program to be able to run on JRE 1.5, than I have to tell Eclipse to set the 'compiler compliance level' to 1.5. This will allow my program to run on older JREs without a problem, assuming that the older JRE supports all of the programs features. Correct?

    And if this is true, than one last question: Is this the 'standard' way of allowing a Java application to run on a wide range of JRE versions?

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to find out the minimum JRE requirement for my Java program

    you're saying that the default for Eclipse is to set the minimum JRE requirement for the application, based on the JDK I had installed when programming
    I didn't say that, but it may be correct. In Eclipse, the programmer is in complete control of setting the compiler compliance level. One of those setting is "Use compliance from execution environment '<blank>' on the Java Build Path," which will default to the level of the JDK installed if selected. If that is not selected and "Enable project specific settings" is selected, then the compliance level can be chosen to be equal to or something less than the JDK. In my case, with JDK 1.7 installed, 1.3 is the lowest compliance level available. There may be source code changes required when reducing the compliance level of existing code, but I'm not sure if Eclipse manages the compliance level so that changes within a certain range are unnecessary or the compiler makes the necessary adjustments, if any. I haven't experimented much with changing compliance levels.
    I programmed using JDK 1.7, and I want the program to be able to run on JRE 1.5, than I have to tell Eclipse to set the 'compiler compliance level' to 1.5. This will allow my program to run on older JREs without a problem, assuming that the older JRE supports all of the programs features. Correct?
    Yes, but as mentioned above, I'm not sure if adjustments to the source will be required. I'd be interested to hear back from you if changes to the source were required and if so, what had to be changed. I'm guessing not, but I'm not 100% sure.
    Is this the 'standard' way of allowing a Java application to run on a wide range of JRE versions?
    Just as the programmer has to be mindful of the demographics of his/her users and create programs that they will be able to run in various languages, screen sizes, etc., the installed JRE should be a consideration and clearly stated in the program's release notes. Users should be notified of the minimum JRE level required to run the program and given a link to the JRE update site if needed. I have't looked for a while, but Google maintains a table of all active Android configurations and the numbers/percentages installed for each. This info gives an Android app writer the ability to maximize the size of the app's possible user base based on the app's Android version or understand why the app is not being widely accepted if it only works in the latest version of Android.

  5. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to find out the minimum JRE requirement for my Java program

    Okay, thanks. Do you know how to set in Eclipse everything that needs to be set to JRE 6?
    I set the project's compliance level to 1.6, but it seems I need to set additional things to JRE 6.

  6. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: How to find out the minimum JRE requirement for my Java program

    Since you started a new topic specific to Eclipse, I'll close this one, mark it solved, and move the other to the IDE sub-forum (already there - thanks).

Similar Threads

  1. Replies: 3
    Last Post: May 16th, 2013, 09:17 AM
  2. Java Program Help! Cant find errors
    By frenchsasha in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 6th, 2013, 10:30 AM
  3. Bundle the JRE with the program.
    By atar in forum Java Theory & Questions
    Replies: 2
    Last Post: April 10th, 2012, 08:38 AM
  4. hardware requirement for Java
    By mandroid in forum Java Theory & Questions
    Replies: 5
    Last Post: June 7th, 2011, 12:52 PM
  5. Java program to find the minimum and maximum values of input data
    By awake77 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 20th, 2008, 05:12 PM

Tags for this Thread