Like rt.jar for like javac

Today I switched an Eclipse project using JDK 6 on OS X to JDK 5.

Even though there are command line tags in javac to produce 1.5 compatible source, the need to use JDK 5 comes into being when implementing interfaces that have grown in the number of methods since Java 5.  A good example is the JDBC classes.  The number of methods in Java 6 versions of the java.sql.Connection interface has grown by at least 6 (look for Since 1.6)

Having the Java 6 rt.jar or classes.jar where that interface resides will expect those new methods to be implemented and lead to a compilation error when you try to build.  On the opposite end, if you blindly start using the latest version of Java, you can easily start using new methods without realising.  Your colleagues will tell you when their 1.5 only environment stops compiling. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *