Friday, October 2, 2009

Running JDK6 on FreeNAS 0.7rc1 rev4735

I had a good experience a few months ago when I re-purposed an old and inexpensive Dell PE400SC server as a network attached storage device running FreeNAS. That system has been a joy to work with, and has served to introduce me to my first experiences with iSCSI mounts from my Windows 7 box.

The underpinnings of FreeNAS are FreeBSD:

freenas:~# uname -a
FreeBSD freenas 7.2-RELEASE-p1 FreeBSD 7.2-RELEASE-p1

...as uname explains. Fortunately, FreeBSD is a system that I've gotten to appreciate and know for several years now. So it was just a matter of time before I started looking for what else this machine could do for me. Sure a few small utilities like screen, autossh, and gawk are nice to have, but my bigger interest lies in java applications, so I really wanted a JDK to support that.

So here are the steps I had to navigate to get the Diablo JDK into FreeNAS. I must say, the FreeNAS documentation site seemed kind of hit and miss for some of this information.


Fetch the java binary


I found this was easier done from Firefox from my Win7 box and saved back to the NAS, in part, because the URL redirects to a POST-only form. Grab the file from:


http://www.freebsdfoundation.org/cgi-bin/download?download=diablo-jdk-freebsd7.i386.1.6.0.07.02.tbz


Make pkg_add happy


There seems to be some confusion about what version of FreeBSD this was built with. Try this:


setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.4-release/


Attempt Diablo install


Try to install the java binary, but beware it may balk.

pkg_add -v diablo-jdk-freebsd7.i386.1.6.0.07.02.tbz


If it does complain, you may need to do a series of individual fetches with pkg_add:

pkg_add -r x11/xtrans-1.0.4

etc., for every complaint. Then retry the diablo install. In the end, I was rewarded with this:

freenas:~# java -version

java version "1.6.0_07"
Diablo Java(TM) SE Runtime Environment (build 1.6.0_07-b02)
Diablo Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode)


...and a working javac!