OS X and Java developer sources

With the Java 6 update 22, Apple not only set the internets on fire regarding their deprecation of Java, they also made it very hard for the core Java users on their platform to actually use the old ball and chain: developers, developers, developers.

It is quite hard to discover where the Apple gods decided to land the new goods, so I figured to write everything up in one blog post for posterity (and my own memory—having to go on another google hunt to do these tasks again would kill me).

First you need to download the developer packages from the connect.apple.com website. This requires a free account so just register and promise your first born (as I understand it, no waving of dead chickens is necessary).

You can download the developer package from this location: Apple Java downloads

Install the package and start up your favorite IDE. Now find the settings where you can tell the IDE where to find the Java sources and paste in the following for Java 6 Update 22:

/Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home/src.jar

Navigating to that folder using Eclipse is pointless as the .jdk extension signifies a package and Eclipse’s navigator doesn’t allow “Show package contents”.

Eclipse 3.4 with openjdk 6 on OS X 32-bit CoreDuo

With the invaluable help of David Green, I was able to run Eclipse on openjdk 6 on my first gen MacBook Pro (you know, those left behind by Apple, running on a 32 bit CoreDuo processor… good to know that Apple supports the early adapters).

With this script that I adapted from David’s blog I was able to start Eclipse 3.4 (Version: 3.4.2
Build id: M20090211-1700) with Landon Fullers openjdk 6 build:

export JAVA_HOME=/Developer/Java/openjdk6-b16-24_apr_2009-r1
export PATH=$JAVA_HOME/bin:$PATH

java -server -Djava.library.path=$HOME/bin/jnilib -Dswt.library.path=$HOME/bin/jnilib -Xms128m -Xmx768m \
    -XX:MaxPermSize=192m -Dosgi.requiredJavaVersion=1.5 -Dorg.eclipse.swt.internal.carbon.smallFonts \
    -cp /Applications/eclipse/Eclipse.app/Contents/MacOS/../../../plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar \
    org.eclipse.equinox.launcher.Main -os macosx -ws carbon -arch x86 -showsplash \
    -launcher /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse -name Eclipse \
    --launcher.library /Applications/eclipse/Eclipse.app/Contents/MacOS/../../../plugins/org.eclipse.equinox.launcher.carbon.macosx_1.0.101.R34x_v20080731 \
    -startup /Applications/eclipse/Eclipse.app/Contents/MacOS/../../../plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar \
    -launcher /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse \
    -keyring $HOME.eclipse_keyring -consoleLog -showlocation -vm $JAVA_HOME

The script misses the shebang, since my hosting provider thinks that I’m trying to execute some serverside exploit…
You’ll have to extract a couple of shared libraries that are packaged in your Eclipse distribution:

jar xfv /Applications/eclipse/plugins/org.eclipse.swt.carbon.macosx_3.4.1.v3452b.jar
jar xfv /Applications/eclipse/plugins/org.eclipse.core.filesystem.macosx_*.jar os/macosx/liblocalfile_1_0_0.jnilib

You’ll have to rename all those libraries to give them a *.dylib extension.

Finally I had to point /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home to the openjdk 6 directory:

sudo mv /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home.old
sudo ln -s LOCATION_OF_OPENJDK /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

Downloading the internet with Maven in a new light

I have my share of complaints like everybody else about Apache Maven and one of them is that upon installation (or upgrading to a new plugin version) it starts downloading half of the available internet. Maven is constructed in a highly modular fashion, requiring lots of different, small, focused Java libraries. I’d like the distribution to contain those libraries, but I digress. Tonight I saw that not only Maven is structured this way. It is something *all* open source projects got.

For example, the much touted Ruby on Rails project with their disdain for everything Java would probably cringe at Maven (it uses XML after all). But installing Ruby on Rails and for example Radiant CMS with some plugins is a futile attempt in finding the right invocations of: script/*, rake, gem, port and other commandline tools you’ll want to get familiar with. All these tools start downloading stuff from the internet from different repositories (SVN, ruby forge, etc).

Maven: you’re not alone anymore in downloading the internet for your builds…

How I revived my HP ScanJet 3300c on OS X

I had this old scanner laying around and found the need to scan some old photos. Of course I could take a picture of the picture using a 10MP digital camera, but somehow that isn’t as pretty or convenient as just scanning.

Apparently I didn’t search well enough for OS X scanner support last time I wanted to scan something. If you go looking for support for your old trusted Windows scanner after you’ve migrated to OS X, you may run into the same trouble I got myself in. Fortunately open source developers have provided the world with a set of drivers for OS X that enables your old trusted scanner under OS X. W00T!

Developers of TWAIN SANE: THANKS!

OS X: Logitech 250 USB headset works on Leopard

In a previous post, which happens to be high on Google’s search results when looking for OS X drivers and Logitech products, I lamented Logitech’s driver support for not working and mostly keeping quiet about it.

I’ve recently upgraded my MacBook Pro to Leopard and it seems that the freezing problem has been fixed. I haven’t encountered the spinning beach ball of death due to connecting my Logitech headset. But I must confess that I am very cautious currently when attaching the headset, and haven’t used it for a while. I’m slightly optimistic that this problem is solved.