Skip site navigation (1) Skip section navigation (2)

FreeBSD Java® Project: How To Install

When installing Java on FreeBSD you have the choice between different Java Development Kits:

OpenJDK on FreeBSD

To install OpenJDK® 6 package use the pkg(8) utility:

pkg install openjdk6

More information on using pkg(8) is available in the FreeBSD Handbook.

This is a native port of OpenJDK to FreeBSD.

cd /usr/ports/java/openjdk6
make install clean

Oracle JDK for Linux

This port installs the Java Development Kit from Oracle which was built for Linux. It will run under FreeBSD using the Linux compatibility.

cd /usr/ports/java/linux-sun-jdk17
make install clean

Note: Please note that due to the current licensing policy the Oracle JDK on FreeBSD binaries can not be distributed and you are only permitted to use them personally. Due to the same reasons you have to manually fetch the source code and patchset for FreeBSD.

If you should have trouble, you can see the FreeBSD Handbook section on "installing applications" for help.