Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I recently deployed an applet that seems to require Java 6 Update 24. I assume the reason for this requirement is the matching JDK version I used to create the applet (I am new to Java).

The fact that my applet requires a Java download/update for users who already have some version of Java installed is a big concern for me; the applets I'm creating slip into a web comic, so it's very disruptive. Having used the most recent version of Java, it seems as though I am able to assume that most of the readers I get will have to update Java to continue reading/playing.

Is there a best practice concerning which version of Java to use to make the process of using an applet easy for end-users? Any reading material on this would be very helpful. Should I be using an older version of Java if I don't require new features? I am using Slick for 2D games.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

Normally the main compatibility issues are between major versions. If you compile for Java 6, it will not run on Java 5 but throw an java.lang.UnsupportedClassVersionError.

So a program complied on Java 6 Update 24 is supposed to work on lower versions of Java 6. But there is a small risk that you invoke a method that was added in a minor release, resulting in a java.lang.IncompatibleClassChangeError or one of its subclasses. The chance for this to happen is really small, usually you get away without explicitly testing older versions.

Stendhal targets Java 6, but tries to be mostly compatible with Java 5. Over the last year the number of users with Java 5 has decreased a lot. I think that is because of the huge improvements Sun made to the automatic update of Java. It is now around 0.1% for us, so we are considering dropping support for Java 5 completely.

share|improve this answer
    
With Java 7 around the corner it's time to stop targeting Java 5. –  David Young Mar 18 '11 at 5:24
2  
@David Young, for server software and controlled environments, it's easy to use the latest versions (after they are considered mature enough). But if your target group is more or less random website visitors, the version actually in use by those is more important than the latest version released. So the percentage of Java 5 users going down drastically is a very good sign. But that is not because Java 7 is to be released next year. –  Hendrik Brummermann Mar 18 '11 at 7:00

Theoretically, if you don't want to require anyone to download a new JVM if they already have one, you must target Java 1.0. Realistically, you can probably expect most if not all of your visitors to have a 1.4 JVM at least, a 1.5 or newer most likely.

btw. if you compiled with 1.6.0_24 it would run fine on any 1.6 JVM, not require a JVM update.

Personally, I'd not bother targeting a 1.4 or earlier JVM any longer. Those are out of support by Oracle (formerly Sun), and users should upgrade anyway (and will be forced to when visiting some other website if not yours that uses applets).

share|improve this answer

Java se6 has been around for a while but there are very few resources on it so if you can develop for java five with books like killer game programming in java and developing games in java then you should be fine as they're written for java se5 and considered best in their fields.

Also, if you're using slick2d I think most of it will work with java 5 without any interactions so I would say aim for java 5.

Another thing to consider is that java updates automatically and if the user has java 4+ they would have upgraded to java 6.

share|improve this answer

Considering Java 6 was released in December of 2006 and runs on just about every major operating system I would target that. Considering Java 6 doesn't really add any language features over Java 5 you could go back, if you aren't using any Java 6 features. However considering Sun stopped supporting Java 5 in November 2009 and thus support for Windows 9x I wouldn't write for it.

Forcing your users have at least Java 6 has other benefits as well as it:

  • Guarantees your users aren't experiencing performance degradation due to using outdated libraries.
  • Reduces the number of JVMs you need to support. I've worked on projects that fail due to incompatibilities between minor versions. It's rare, but sucks when it happens. Thus it's better to target the version you are developing on or better and politely ask the user upgrade than it is to have your application crash outright because you didn't test version 1.5 Update 6.
  • Improvements to your coding style and standards. Stylistically Java has one of the slickest enum implementations ever, but you need to use at least version 1.5 to get access to it.
  • Eliminate your chances of implementing a deprecated feature. (There aren't many but they do exist.)
  • Ease your upgrade path to 1.7 which has some long overdue features.
  • Some older JVMs have security issues. Forcing your user's to upgrade helps protect them against malicious programs, written by other people of course.

There are plenty of other reasons to force users to have 1.6, but without knowing your specific requirements it would take me days to list them. In the end though their is little reason to target older Java versions unless you specifically have to.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.