Thursday, June 26, 2008

Eclipse 3.x and Java 1.6 on OSX

Eclipse 3.x can't run using Java 1.6 on OSX. It is a known issue and probably won't be resolved for a while thanks to the fact that Apple has only shipped a 64bit 1.6 JVM. Thus, in order to get Eclipse 3.x to run with Java 1.6 set as command line default on OSX, you need to do the following:

  1. In /System/Library/Frameworks/JavaVM.framework/Versions, symlink CurrentJDK -> 1.6. Leave Current -> A
  2. I also changed the location of the java binary to: /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Commands/java
  3. Right/Ctrl click on the Eclipse icon, Show Package Contents, edit the Info.plist file and uncomment the line that says: <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java</string>
Now, you will have the best of both worlds as things stand today. Java 1.6 on the command line and Eclipse running under 1.5. Oh, by the way, if you haven't noticed yet, Eclipse 3.4 is out.

2 comments:

Adrian said...

Don't change the symlinks around - it will come back to bite you. You can use the Java Preferences control panel to change the Java version for most situations, including the command line java and javac commands. For everything else just treat it like a standard UNIX system and adjust your PATH and JAVA_HOME variables.

Adjusting the symlinks has never been required on OS X and has always been strongly discouraged by Apple.

Jon Scott Stevens said...

Yea, that didn't work for me.