How easy is it...
The JDK and JRE packages on the FreeBSD Foundation require the following to install and run correctly:
inputproto-22.214.171.124, javavmwrapper-2.3, kbproto-1.0.3, libICE-1.0.4,1, libSM-1.0.3,1, libX11-1.1.3,1, libXau-1.0.3_2, libXdmcp-1.0.2, libXext-1.0.3,1, libXi-1.1.3,1, libXp-1.0.0,1, libXt-1.0.5, libXtst-1.0.3, pkg-config-0.22, printproto-1.0.3, recordproto-1.13.2, xextproto-7.0.2, xproto-7.0.10_1, xtrans-1.0.4
If you run a Desktop based system with Xorg installed most of these are probably already there, on my laptop which has KDE 3.5.7 for the GUI all I had to do was install one package first:
pkg_add -r javavmwrapper
If you don't have a required package it will tell you what you need to install when you try to pkg_add Java. Most probably can be pkg_add -r'd unless you want to the ports.
I then went over to the FreeBSD Foundation website to download Java
If you only want to run Java programs, you will need the JRE (Java Runetime Environment) but if you wish to develop Java programs you'll require the JDK (Java Development Kit).
The packages currently are for FreeBSD 5.5/i386 and FreeBSD 6.1/i386 and amd64. Just download the one that matches your FreeBSD major branch and CPU Architecture. I fetched both JRE and JDK for FreeBSD 6.1/i386 which is about a 70MB download combined, my Laptop runs PC-BSD v1.4 so the underlaying system is FreeBSD 6.2-Stable, no problems so far.
You need to accept the license agreement to download and when you pkg_add, just scroll to the bottom and type 'yes' and press enter, you can probably use the shift+g command to jump to the bottom of the license.
I think because of the terms that the JRE/JDK were licensed for distro we've got to live with the manual download. Once you've got your packages downloaded, just do a :
of course replacing ./ with the path (if necessary) and the filename with the proper one. Tip: If you don't want to typo it, use tab completion in your shell. I usually just download things to /tmp and cd over to it. You also need to be root in order to run pkg_add with any possibility of success. Depending on ones shell a 'rehash' command might also be needed before the programs can be found in the command prompt.
which tells me that java and javac are working, and it passed the test of compiling a small test program and running it.