Google is tooootally lame!

March 31st, 2009 by nils

Just to clarify, I don’t think google is lame. I just thought it would make a flashy title. Anyway, when I attached some photos to a mail recently, I got this message:

Not sure about the first part, it actually seemed pretty confusing to me, but the last part I think is good. Straight forward, no bullshit. We messed up and we’re working on it. I like that! Certainly better than this:

Lotus Notes Error Message

Lotus Notes Error Message

Java Versions on Mac OS X

March 3rd, 2009 by nils

Update: This post refers to OS X 10.5 “Leopard”, if you are using 10.6 “Snow Leopard”, you might want to consider reading my post “Java and Snow Leopard” instead.

I just started using my Mac as a development machine and thought I’d share some of the issues and solutions I came across. I’m using Java 6, Tomcat 6, Eclipse 3.3.2 (Europa), hibernate 3, Spring 2.0.3 and tapestry 1.4.5.

The first issue I came across was an

UnsupportedClassVersionError: Bad version number in .class file

error when I tried to start tomcat. (I’m using the sysdeo plug-in to control tomcat, even though I’m aware that WTP is much better… I have my reasons, but that’s beyond the scope of this post.)

Now the title of the console in Eclipse revealed the problem, the Sysdeo plug-in was using version 1.4 of the Java RE. The thing is, I didn’t notice this until I tried a whole bunch of other stuff… which cost me quite a bit of time, but also helped understand a few things better.

OS X keeps the different Java versions neatly separated in the

/System/Library/Frameworks/JavaVM.framework/Versions

directory. By creating or overwriting the symbolic link “CurrentJDK”, you can change the default JDK version of your system. To do this, you have to change to the Versions directory and set a new symlink with ln:

$cd /System/Library/Frameworks/JavaVM.framework/Versions
$sudo ln -fhsv 1.6 CurrentJDK

After providing the administrator password, the default JDK will be set to version 1.6. Unfortunately, after doing this, I couldn’t start Eclipse anymore. The fix for this is to edit the following file:

/Applications/eclipse/Eclipse.app/Contents/Info.plist

and un-comment the following line:

<string>-vm</string><string>/System/Library/Frameworks/
JavaVM.framework/Versions/1.5.0/Commands/java</string>

This tells Eclipse to use a specific Java version, instead of the platforms default one. Now I was able to start Eclipse again and tomcat started without exceptions when I manually deployed my war files. My next step was to try Sysdeo to start Tomcat, which is where I realized that all I would have had to do was to set the correct JVM in Preferences > Tomcat > JVM Settings. Anyway, learned something on the way :)

Here are some links that helped me:

http://blog.kischuk.com/2008/05/08/running-eclipse-on-macbooks-with-java-6/

http://www.insanelymac.com/forum/index.php?showtopic=58817&st=0&p=435204&#entry435204

http://johnnywey.wordpress.com/2008/06/21/os-x-and-java-unsupportedclassversionerror/