First off, the FreeBSD documentation regarding Java is just terrible outdated.
However, it’s pretty easy once you get the gist. `pkg_add -r openjdk6` is all that was needed to get `java` and `javac` onto the FreeBSD 8.2 VDS 8-stable system. However, `pkg_add -r tomcat7` didn’t work as expected, since, apparently, it depends on java/jdk16, so it tries installing jdk-1.6.0.3p4_27, and fails, not installing tomcat7, either. Also, it seems like tomcat7 tries installing a bunch of other packages of questionable benefit, probably due to the java dependancy?
In any case, I guess just about all java software on FreeBSD (and is it only java software?) has to be installed with the —no-deps option. Indeed, `pkg_add -r —no-deps tomcat7` worked just perfectly fine, without any perl or python dependences that it seemed to try installing earlier just for tomcat7, and `/usr/local/etc/rc.d/tomcat7 onestart` was successful in bringing dependentless tomcat7 up and running, as casual on port 8080.
Anyhow, it shows a few things: documentation in FreeBSD is indeed very outdated; ports tree dependencies are still quite horrible and reasonably broken; yet Java actually seems to work on FreeBSD with little initial effort. :-)