Monday 7 July 2008

Netbeans on Mac and Xalan Errors

With Netbeans 6.1 running on Java 6.x on an Intel Mac running Leopard, you will find that Netbeans may not start - reporting corruption due to Xalan (I forget the exact message).

As a checkpoint, do the following:

In a terminal shell, running which java will give the response

/usr/bin/java

ls -al /usr/bin/java shows the following symlink

lrwxr-xr-x 1 root wheel 74 9 May 21:25 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

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

and ls -al to give all the java versions:


drwxr-xr-x 16 root wheel 544 6 Jul 09:29 .
drwxr-xr-x 11 root wheel 374 29 May 19:18 ..
lrwxr-xr-x 1 root wheel 5 9 May 21:25 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 14 Jan 05:12 1.3.1
lrwxr-xr-x 1 root wheel 5 21 Feb 16:22 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 9 May 21:25 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 21 Feb 16:22 1.4.2
lrwxr-xr-x 1 root wheel 5 21 Feb 16:22 1.5 -> 1.5.0
drwxr-xr-x 9 root wheel 306 22 May 20:13 1.5.0
lrwxr-xr-x 1 root wheel 5 9 May 21:25 1.6 -> 1.6.0
drwxr-xr-x 11 root wheel 374 6 Jul 09:28 1.6.0
drwxr-xr-x 8 root wheel 272 9 May 21:25 A
lrwxr-xr-x 1 root wheel 3 6 Jul 09:29 Current -> 1.5
lrwxr-xr-x 1 root wheel 3 6 Jul 09:29 CurrentJDK -> 1.5


This is what you should have to solve the netbeans problem. Do not update the symlinks to point to Java 1.6.

--

Now, if you are having the Xalan error you need to remove references to xalan from Netbeans.

cd $HOME/.netbeans

find 6.1 -name xalan.jar -print | xargs rm -f (RUN THIS AT YOUR OWN PERIL - STANDARD DISCLAIMERS APPLY)

Next, edit /Applications/Utilities/Java/Java Preferences.App and tell it that you want to use java6.

Finally, open Netbeans and in Project Properties -> Libraries, click on Manage platforms and add Java6.0
Then set your project in Project Properties -> Source, and Project Properties -> Libraries to use that platform.


No comments: