Why We Still Need Java 1.4

Joshua Nichols  Author
William L. Thomson Jr.  Editor

Updated December 8, 2006

1.  Primary Reasons

There are two primary reasons for requiring Java 1.4, with regards to Gentoo and building packages.

  1. There are still packages which don't compile when built with Java 1.5. In these cases, the new Java build system switches to a 1.4 JDK for building
  2. It is needed for packages that haven't been migrated to use the new Java system. This is necessary, otherwise we encounter the same exact problems that prompted the initial package.mask of Java 1.5.

2.  1.5 package.mask recap

Unable to build/compile

Just to recap why Java 1.5 was package was package.mask'd.... It really comes down to backwards compatibility, and that Java 1.5 isn't 100% backwards compatible with Java 1.4. Things that ran with Java 1.4 should still run with Java 1.5... but some things that once built with Java 1.4 no longer compile with Java 1.5.

  1. There's a new reserved keyword with Java 1.5, enum. So where you used to be able to use enum as a variable name, you no longer can in 1.5.
  2. A number of new methods have been introduced to some abstract classes and interfaces. If a particular implementation doesn't implement the new methods, then it won't compile against Java 1.5.

UnsupportedClassVersionError

Now, say you're using Java 1.5 to build all your packages, and then you come up to a package that can't compile for one of these reasons? It'd fail for one. But then you may try with Java 1.4... and all is well until you see a compile error: UnsupportedClassVersionError. What does this mean though?

Well, each major release of Java has it's own version of bytecode. Bytecode is forward compatible, ie run 1.4 bytecode in 1.5, but not backwards compatible. If you try to use 1.5 bytecode in 1.4, you will see the infernal UnsupportedClassVersionError. This happens because, since you were using Java 1.5, the dependencies of the package you were just trying to compile with 1.4 were built with 1.5, and the default behavior is to build the highest possible bytecode.

So, these are the reasons Java 1.5 was package.mask'd, and why we need to use Java 1.4 for building unmigrated packages.

3.  How the new system helps

Here is a few reasons how the new java system helps correct the situation.

4.  I still don't want 1.4

For now you pretty much have to have a 1.4 jdk installed. Work is being done to get all packages migrated to the new java system. Along with testing them under 1.5, both compile and running. Which is a pretty large task, considering we still have to maintain other packages in the mean time.

There is no time frame for when Java 1.4 will no longer be required. We do welcome any help with migrating the remaining packages causing the 1.4 dependency. Then testing the packages under a 1.5 jdk and jre.