Upgrading to Java SE 6

March 25, 2009
Tags:

I’ve been looking forward to trying out the new Wonderland, Version 0.5 Developer Release 3, and I finally got to it yesterday.  I used netbeans to check it out, and that worked first try.  Building, however, failed.  The complaints looked pretty basic, so I checked the system requirements and sure enough, I needed to upgrade to Java SE 6.  I did the download and install from Apple’s site, no problem, except it says:

... adds Java SE 6 version 1.6.0_05 to your Mac. This update does not
replace the existing installation of J2SE 5.0 or change the default
version of Java.

Well, shoot, I need to change the default.  I tried setting JAVA_HOME, but that had no effect.  java -version persisted in reporting version 1.5.whatever, as did Netbeans.  I googled around and found references to the symlinks in /System/Library/Frameworks/JavaVM.framework/Versions, one of which is called “Current” and was pointing to A which pointed to 1.5 which pointed to 1.5.0.

Now, what I should have done at this point is execute Applications -> Utilities -> Java -> Java Preferences, but unfortunately I just did sudo rm and sudo ln and manually moved the Current and CurrentJDK symlinks.

Sometime after doing that, I noticed that Netbeans was no longer working.  I set that aside for later, too eager to try the build from the command line.  Sure enough, it worked!  Took a while, but it built, now that I had the right version of Java.

Next step, I ran the server:

% ant run-server

And that worked, too!  Now if only the client would run, I’d be on my way…  But no such luck.

% cd core
% ant run
-- snipped out lots of output, well not that much, a page or two --
[java] 2009-03-25 14:05:53.515 java[42245:10b] Apple AWT Startup Exception : *** -[NSCFArray insertObject:atIndex:]: attempt to insert nil
[java] 2009-03-25 14:05:53.560 java[42245:10b] Apple AWT Restarting Native Event Thread

I searched the Wonderland forum, which had never failed me yet.  But no clue.  What I should have done at this point (duh!) is turn to google.  But alas,  I am embarrassed to admit, I contacted a busy Wonderland developer, Jordan Slott, who happened to be online.  He had never seen this error before, checked a few things, then he googled and found this wonderful post, correctly identified in the comments as a lifesaver.

Just like the blogger, I had set Current to the actual release I wanted to use instead of setting it to A which then points to the release I wanted.  Turns out, that breaks AWT.  I fixed the links, restarted the server, and then running the client worked.  Some of the symlinks in Versions now are:

lrwxr-xr-x 1 root wheel 5 Nov 12 14:40 1.5@ -> 1.5.0
drwxr-xr-x 9 root wheel 306 Mar 24 10:53 1.5.0/
lrwxr-xr-x 1 root wheel 5 Nov 12 14:40 1.6@ -> 1.6.0
drwxr-xr-x 8 root wheel 272 May 9 2008 1.6.0/
drwxr-xr-x 9 root wheel 306 Mar 24 16:10 A/
lrwxr-xr-x 1 root wheel 1 Mar 25 14:33 Current@ -> A
lrwxr-xr-x 1 root wheel 3 Mar 25 14:34 CurrentJDK@ -> 1.6

Oh and guess what?  Netbeans magically runs again now, too.  What a surprise.

Share

Leave a Reply