Java – Can you downgrade Java on a Mac

applejavamac-osx

I'm testing Snow Leopard for our IT team in preparation for it's actual launch. I'm currently running seed 10A394, which comes with Java JDK 1.6.

I found one Java desktop application that no longer runs under Snow Leopard, the app won't even start. The vendor is recommending that I downgrade to JDK 1.5.

The problem is that every Java for Mac package that I've been able to find first checks that it's about to be installed on the version of Mac OS that Apple had in mind when the package was created. This page is a good example, there are two different packages but each explicitly checks for MacOS 10.4 or 10.5 before installing, so neither works on Snow Leopard.

Once I get it installed, I know how to change the order so that the lower version is preferred — I just can't find any packages that will install.

Best Answer

MacOS comes with versions of Java going back as far as 1.3. See /System/Library/Frameworks/JavaVM.framework/Versions. The only time you need to install from a package is when the latest Java is newer than your OS version and you can't use the Software Update for some reason.

The vendor of your application should really take responsibility, but you can probably fix the problem by editing the .plist of the app. Right click the application and choose Show Package Contents then open the Info.plist file with a text editor. You'll see a Java dictionary in that file and a key JVMVersion. Change the value to 1.5* (1.4+ would mean anything after version 1.4, 1.6* would be any version of 1.6.) That will get your app running in Java 1.5.

However this may not be the whole story. Along side the Info.plist, you'll find MacOS/JavaApplicationStub. This is the actual MacOS X Binary that launches the JVM. The developer may have shipped their app with an old version of this file that is not compatible with your OS. You'll have an up to date copy of this file on your machine already at /System/Library/Frameworks/JavaVM.framework/Versions/Current/Resources/MacOS/JavaApplicationStub. Replace the application's version with this one.

The application might still not run because (for example) it can't load 32-bit native libraries after being launched as 64-bit. In that case you can strip out the 64-bit portion of the Stub with the lipo command: lipo -remove x86_64 JavaApplicationStub -output JavaApplicationStub

Hope this works. And if it does, be sure to let the developer of the app know of course.