Tuesday, January 24, 2012

Install OpneJDK7 on FreeBSD

FreeBSD deals many kind of JDKs. But, at the time of writing this article, OpenJDK7 is the only one that are ready for Java7. So that I introduce the way to install OpneJDK7 on FreeBSD.

Edit /etc/make.conf for OpenJDK7

Add these definitions to /etc/make.conf:

Install via packages (mandatory)

# pkg_add -r openjdk7
That's all. Let's check the output of java -version command.

Install via ports (option)

If we want to install openjdk7 via ports, however, we must prepare for another JDK to be installed. In this article, I suggest to install openjdk7 via packages(above) at first, then install openjdk7 via ports.
# pkg_add -r openjdk7
# cd /usr/ports/java/openjdk7
# make install clean
# pkgdb -F
Let's check again java -version command.


Kavitha H Yogaraj said...


I'm a newbie to freebsd, I could install java and run in ubuntu but not in freeBSD.

When I use this command pkg_add -r openjdk7
I get this error
Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/openjdk7.tbz: File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/openjdk7.tbz' by URL

And then, when I try to mention the site name
I again get invalid command error.

Could you please help me in installing java in FreeBSD?

I even want to run java web application headless.

Youhei Kondou said...

Just use this URI:

Zsolt Kiss said...

how to change URL

Post a Comment