JDK 1.4 Beta 2 won't work with JBuilder
When compiling a ".java"-file the compiler puts format version info in the first bytes of the resulting class file.
In Merlin (JDK 1.4) Beta2 Sun has changed the version info of many of the JDK's class files to '48.0'
while previous JDKs used versions up to '46.0'.
I do not know if there actually are any differences in the class file format.
There are almost certainly some minor changes. Unfortunately the JDK 1.4 release notes fail to adress this incompatibility.
If anyone knows some details please e-mail me.
The JDK tools provided with the Beta release can all deal with version '48.0' class files.
But if you use other tools (like the Borland compiler), they will probably refuse to load the JDK's class files.

Patch the JDK 1.4 Beta 2 release
To be able to play around with Merlin Beta 2 using JBuilder5, I wrote a little hack,
that patches all jar files in the JDK to a version of max. '46.0'.
I got my current project running without noticing any problems. (Besides I learnt how to use the java.util.zip/jar-packages :-)

It might be good to get a first impression of the Beta.
A fix from Borland is needed urgently.
If in any part of your application you get some strange errors, especially related to class loading, this patch may well be the reason.
Please E-Mail me with details about where the problems occur.

Get the java source: ClassVersionLimiter.java

If your JDK's root directory isn't "C:\j2sdk" (almost certainly if you do not use windows)
then edit the path in the code (one of the very first lines).
Be sure to have write access to the JDK sub-directories.
Compile the code. (Using the JDK 1.3.1 that came with JBuilder or use javac at the command line.)
Run the resulting class. It will patch all class files in all jar files in your JDK to have a version info of '46.0' at max.
The original jar-files will get copied to .BAK-files.

Comments to mail@StephenKelvin.de

Stephen's code seems to work very well indeed
Since we are still using Borland JBuilder 5 ( now an old version ) this patch to Merlin was a real life saver!
If anything we found Stephen's fears to be an exageration, but we repeated them all the same

It really is as simple as:

  • Edit the first argument to the ClassVersionLimiter constructor in the main method
  • Compile and execute the Java file

  • 	public static void main(String[] args) 
    		/* Edit The First Argument */
    		ClassVersionLimiter classVersionLimiter = new ClassVersionLimiter("C:/j2sdk", 46, 0);
    javac -classpath .;c:\jbuilder5\jdk1.3\lib ClassVersionLimiter.java

    java -classpath .;c:\jbuilder5\jdk1.3\lib ClassVersionLimiter