This page looks best with JavaScript enabled

Java Version on FreeBSD

 ·  🎃 kr0m

FreeBSD allows us to install various versions of Java-openjdk. To do this, we will have to install the package in question and configure the JAVA_VERSION environment variable. This article explains the steps to follow as well as how to run Java web applets using IcedTea.

First, we check the available versions:

pkg search openjdk

openjdk-7.261.02.1,1           Java Development Kit 7  
openjdk11-11.0.7+10.2_1        Java Development Kit 11  
openjdk12-12.0.2+10.4_1        Java Development Kit 12  
openjdk13-13.0.3+3.1_1         Java Development Kit 13  
openjdk14-14.0.1+7.1           Java Development Kit 14  
openjdk8-8.252.09.1            Java Development Kit 8

In my case, we install openjdk14:

pkg install openjdk14

We configure the version to use in the JAVA_VERSION environment variable. This will be done in one way or another depending on the shell we use. In my case, Bash:

vi .bashrc

export JAVA_VERSION=14

We check the version:

java -version

openjdk version "14.0.1" 2020-04-14  
OpenJDK Runtime Environment (build 14.0.1+7-1)  
OpenJDK 64-Bit Server VM (build 14.0.1+7-1, mixed mode, sharing)

To be able to launch Java applets from the browser, we must have IcedTea installed:

pkg install icedtea-web

In theory, we can configure the browser to open the file directly, but I prefer to save it and open it manually:

/usr/local/bin/itweb-javaws -verbose FILENAME.jnlp

For most KVMs, having OpenJDK and IcedTea installed will be sufficient, but there are some models such as those from SuperMicro that are problematic. For these cases, we will use the Linux binary through Linux-FreeBSD compatibility as explained in this article .

If you liked the article, you can treat me to a RedBull here