26.8 C
Senior Writer and partner

How to install Java on FreeBSD 12?

Hello friends, the goal of this tutorial is for you to learn how to install Java on FreeBSD 12 so you can enjoy it and use it for different purposes.

We already know that Java is one of the most used programming languages in the world. Besides this, many applications need Java to run and therefore many people need it.

On the other hand, many people use FreeBSD 12 as an operating system for a server. Many dedicated server applications need Java to run as well as to serve applications.

So, let us do it.

Install Java on FreeBSD 12

- Advertisement -

For this tutorial you need to run sudo. So this program has to be enabled and working properly. For that, read our tutorial about it:

How to enable sudo on FreeBSD 12?

Once you have done it, you can continue with the post.

Next is bscar Java in the official FreeBSD 12 repositories.

:~$ sudo pkg search openjd
bootstrap-openjdk11- Java Development Kit 11
bootstrap-openjdk6-r450701 Java Development Kit 6
bootstrap-openjdk8-r450802 Java Development Kit 8
openjdk-7.161.01,1 Java Development Kit 7
openjdk-jre-7.161.01,1 Java Runtime Environment 7
openjdk11-11.0.5+10.1 Java Development Kit 11
openjdk12-12.0.2+10.3_1 Java Development Kit 12
openjdk13-13.0.1+9.1 Java Development Kit 13
openjdk8- Java Development Kit 8
openjdk8-jre- Java Runtime Environment 8
rxtx-openjdk8-2.2p2_4 Native interface to serial ports in Java
1.- Search for Java on the FreeBSD repositories
1.- Search for Java on the FreeBSD repositories

In the image we can see that there are several versions of Java available, but only version 8 contains both JDK and JRE. Therefore, this is the version that we will install.

:~$ sudo pkg install openjdk8
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 27 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
libXtst: 1.2.3_2
libXi: 1.7.10,1
libXfixes: 5.0.3_2
libX11: 1.6.9,1
libxcb: 1.13.1
libXdmcp: 1.1.3
xorgproto: 2019.2
libXau: 1.0.9
libxml2: 2.9.10
libpthread-stubs: 0.4
libXext: 1.3.4,1
libXrender: 0.9.10_2
libXt: 1.2.0,1
libSM: 1.2.3,1
libICE: 1.0.10,1
fontconfig: 2.12.6,1
expat: 2.2.8
freetype2: 2.10.1
dejavu: 2.37_1
mkfontscale: 1.2.1
libfontenc: 1.1.4
javavmwrapper: 2.7.4
java-zoneinfo: 2019.b
giflib: 5.2.1
libinotify: 20180201_1
alsa-lib: 1.1.2_2
Number of packages to be installed: 27
The process will require 234 MiB more space.
89 MiB to be downloaded.
Proceed with this action? [y/N]:
2.- Install Java on FreeBSD 12
2.- Install Java on FreeBSD 12

Once Java is installed a few more things need to be done to get it ready for work. Because this OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and
procfs(5) mounted on /proc.

So, to do it, run these commands:

:~$ sudo mount -t fdescfs fdesc /dev/fd
:~$ sudo mount -t procfs proc /proc

This solves the problem temporarily, if we want to avoid running these commands every time we start the system, we have to edit the file /etc/fstab and add the following:

:~$ sudo nano /etc/fstab
fdesc /dev/fd fdescfs rw 0 0
proc /proc procfs rw 0 0
3.- Configuring FreeBSD 12 to work with Java
3.- Configuring FreeBSD 12 to work with Java

So, save the changes and close the file.

Now, you can check the Java version.

:~$ java -version
4.- Java version
4.- Java version

So, Java is ready for the action.


Java is a fairly popular platform and this makes it necessary for many FreeBSD 12 developers and users to run or serve applications of this type. Today you have learned how to install it without problems.

Please share this post and join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article