FreeBSD on a ThinkpadSwapping hard drive boot disks between machines

Java on FreeBSD

As you may have noticed, this web site has a couple of Java applets on it. I figured I should be able to access the applets via Mozilla on FreeBSD. The Java VM under Mozilla was working successfully on Linux, so I expected it to be an easy process.

On the basis of no research whatsoever, I decided to accept the Mozilla offer to download the Linux Java plugin when I tried to access one of the applets. My first problem was that it failed to install, due to access permissions. OK, I'll download it as root. That seemed to work OK, but using the 'About Plugins' menu revealed that no java plugin was recognised by Mozilla.

Mozilla was complaining that it could not find the shared library Well, I had one of those in the /usr/X11R6/lib/mozilla/plugins/java2 subdirectories, which is where the plugin download had placed it. I read (somewhere) that you could tell Mozilla about the plugin by creating a link under the ~/.mozilla/plugins directory. Well, that changed things, but not particularly for the better. Now Mozilla was complaining that it couldn't find

I then started up the path of creating links, one by one, to the library modules that seemed to match what Mozilla was looking for:

At this point I realised the futility of what I was doing. I deleted all the links I had created, and started to research the problem properly. Naturally, I quickly found out what I had to do. The resolution is outlined at

In short, java 1.3.1 needs to be installed, patched for FreeBSD, which can only be performed via the ports system. The make process will identify the downloads required, but rather than getting some of the them automatically, it tells you to download them manually, and place them in /usr/ports/distfiles. Once make is complete, issue the command make install.

Once the java installation is complete, you must create a link from /usr/X11R6/lib/mozilla-devel/plugins/ to /usr/local/jdk1.3.1/jre/plugin/i386/ns600/

After all that, the applets were running successfully. The only problem is that the VM is a slow as a dog!


Much later, I used portupgrade to bring all the ports up-to-date, forgetting about the Java wrinkles. I didn't remember until I tried to run an applet in Mozilla, and nothing happened. I therefore started the process of installing the j2dsk-1.4.2 via ports.

Once again, this provides instructions on manually downloading the various source packages, and placing them in /usr/ports/distfiles, but there is one difference. If you fail to issue the following commands prior to performing the build, it will fail.

  kldload linprocfs
  mount -t linprocfs linprocfs /compat/linux/proc

The absence of linprocfs affects the Linux version of Java which is used to bootstrap the native FreeBSD version. You will find the Linux Java VM issues the following error message on startup:

  Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location

What's worse is that the file usr/ports/java/jdk14/work/control/build/bsd-i586/gensrc/java/util/ contains this error message as its first line, causing the native JDK build to fail.

If you do end up in this situation, recovery is possible. Delete the errant error message in the file, set the linprocfs up as shown, and restart the make.

The final step, to support Java applets in Mozilla, is to create a link for The locations are slightly different to those given above, since Mozilla is now at version 1.7.3.

  ln -s /usr/local/jdk1.4.2/jre/plugin/i386/ns610/ \

The VM speed has improved considerably.

FreeBSD on a ThinkpadSwapping hard drive boot disks between machines