Working around buggy java applets

Having recently upgraded to FreeBSD 7-CURRENT, and therefore no longer able to use the precompiled java/diablo-jdk15 port, I had to bite the bitter apple and pollute my FreeBSD installation with a Linux emulation layer in order to bootstrap the java/jdk15 port.

The installation went pretty smooth, but it turned out my home banking applet failed to load with this Java SDK. The error was a result of a java.io.IOException: open HTTP connection failed – the applet was unable to dynamically load its class files over HTTP.

After a bit of investigation it turned out the home banking applet didn’t support IPv6 properly. While it is possible to build java/jdk15 without IPv6 support, this seemed a bit overkill just to get one buggy applet working…

Luckily, the solution turned out to be pretty simple. Setting the following in ~/.java/deployment/deployment.properties makes the JVM prefer IPv4 over IPv6, thus bringing the buggy applet back to life:

deployment.javapi.jre.1.5.0-p4.args=-Djava.net.preferIPv4Stack=true

Don’t forget to restart your browser or java application after setting this value in order for it to have any effect.

One thought on “Working around buggy java applets”

  1. Thanks for the tip. It was useful, but I found that it is necessary to put a backslash before the second “=”. In my system I have this:

    deployment.javapi.jre.1.5.0_13-p7.args=-Djava.net.preferIPv4Stack\=true

Leave a Reply

Your email address will not be published. Required fields are marked *