Some time ago I blogged about running Eclipse (Ganymede) on SoyLatte. Since then there has been little improvement in the state of Java on the Mac. Apple has released a Java 6 for Mac, but it's a 64-bit only VM which crashes regularly when running Eclipse. Having heard about recent improvements in performance for 64-bit VMs using pointer compression (PDF paper), I decided to have another look at launching Eclipse with an OpenJDK-based VM such as JDK7. After a few false starts I managed to get it working. Here's what I did:
First, to get JDK7 on my machine. I followed these instructions to build JDK 7 from source. The instructions didn't work perfectly for me -- but they were pretty good. Basically followed everything verbatim with the exception that I had to install MacPorts and use it to get wget.
With a 32-bit JDK7 on my machine, now to use it to start Eclipse. I downloaded the latest I-build of 32-bit Eclipse 3.5 from here (Look for '3.5 Stream Integration Builds').
Using a combination of jconsole and guesswork I came up with this shell script to start Eclipse:
# DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y
MEM_OPTS=-Xms1024m\ -Xmx1536m\ -XX:MaxPermSize=256m
$JDKPATH/bin/java $DEBUG_OPTS \
-cp $ECLIPSE_LOC/plugins/org.eclipse.equinox.launcher_1.0.200.v20090429-1630.jar \
-XstartOnFirstThread $MEM_OPTS \
-os macosx -ws cocoa -arch x86 \
-showsplash -launcher $ECLIPSE_LOC/Eclipse.app/Contents/MacOS/eclipse \
-name Eclipse \
--launcher.library $ECLIPSE_LOC/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.0.0.v20090429-1630 \
-startup $ECLIPSE_LOC/plugins/org.eclipse.equinox.launcher_1.0.200.v20090429-1630.jar \
-data $WORKSPACE \
-keyring /Users/dgreen/.eclipse_keyring -consoleLog -showlocation \
Note that all of the above should appear on one line: your browser may split it into multiple lines.
After starting Eclipse as above I saw the following stack trace on startup:
java.lang.UnsatisfiedLinkError: no swt-pi-cocoa-3547 or swt-pi-cocoa in swt.library.path, java.library.path or the jar file
... snip ...
To solve the problem I extracted all of the *.jnilib files from org.eclipse.equinox.launcher_*.jar and put them in a lib folder. I then renamed all of those *.jnilib files in the lib folder so that they had *.dylib file extensions. I ended up with a file structure as follows:
david-greens-macbook-pro:MacOS dgreen$ pwd
/Users/dgreen/Downloads/eclipse/Eclipse.app/Contents/MacOS <--- where I put the files
david-greens-macbook-pro:MacOS dgreen$ ls -l *.sh lib
-rwxr-xr-x@ 1 dgreen staff 1100 8 May 15:47 eclipse.sh <--- the startup script
lib: <---- the lib folder for shared libraries
-rw-r--r-- 1 dgreen staff 37104 8 May 14:20 libswt-awt-cocoa-3547.dylib
-rw-r--r-- 1 dgreen staff 287116 8 May 14:20 libswt-cocoa-3547.dylib
-rw-r--r-- 1 dgreen staff 539240 8 May 14:20 libswt-pi-cocoa-3547.dylib
-rw-r--r-- 1 dgreen staff 300428 8 May 14:20 libswt-xulrunner-cocoa-3547.dylib
Trying the shell script again, Eclipse started up and ran beautifully! Once again I'm running Eclipse with a newer-than-Apple-will-give-me VM, this time JDK 7!! My next step is to compile a 64-bit JDK7 and see if it works too... I have high hopes.
- Your Team Might Not Be As Effective As You Think
- Faster Feedback Loop on Code Reviews
- Surfacing Abstractions in Code Reviews
- Architecting for the Value Stream
- Article Index
subscribe via RSS