Building JAVA MongoDB Driver - linux-on-ibm-z/docs GitHub Wiki
Building MongoDB Java Driver
Below versions of MongoDB Java Driver are available in respective distributions at the time of creation of these build instructions:
- Ubuntu (22.04, 24.04) have
3.6.3
General Notes:
- When following the steps below please use a standard permission user unless otherwise specified.
- A directory
/<source_root>/will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
MongoDB Java Driver Jars are available and can be downloaded from here. Refer to instructions here for installation and usage of this driver. To use these Jars, Java needs to be installed on mentioned distributions.
Note: MongoDB Java Driver version 5.11.0 was verified at the time of creation of these instructions.
1. Install Dependencies
-
RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
sudo yum install -y tar wget curl -
SLES (15 SP7, 16)
sudo zypper install -y wget tar curl gawk which -
Ubuntu (22.04, 24.04)
sudo apt-get update sudo apt-get install -y tar wget curl -
Build libffi library (For AdoptOpenJDK8 hostpot on Ubuntu 24.x)
cd $SOURCE_ROOT/ sudo apt-get install -y build-essential wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz tar xvfz libffi-3.2.1.tar.gz cd libffi-3.2.1 ./configure --prefix=/usr/local make sudo make install sudo ldconfig sudo ldconfig /usr/local/lib64
2. Install Java
-
With IBM Semeru Runtime
- Download and install IBM Semeru Runtime (Java 8, Java 11, Java 17 or Java 21) from here.
-
With Eclipse Adoptium Temurin Runtime
- Download and install Eclipse Adoptium Temurin Runtime (Java 11, Java 17 or Java 21) from here.
-
Download and install AdoptOpenJDK Hotspot (Java 8) from here only for Ubuntu 24.x and above.
-
With OpenJDK 8
- RHEL (8.10, 9.6, 9.7, 9.8)
sudo yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel - SLES 15 SP7
sudo zypper install -y java-1_8_0-openjdk-devel - Ubuntu (22.04, 24.04)
sudo apt-get install -y openjdk-8-jdk
- RHEL (8.10, 9.6, 9.7, 9.8)
-
With OpenJDK 11
- RHEL (8.10, 9.6, 9.7, 9.8)
sudo yum install -y java-11-openjdk - SLES 15 SP7
sudo zypper install -y java-11-openjdk-devel - Ubuntu (22.04, 24.04)
sudo apt-get install -y openjdk-11-jdk
- RHEL (8.10, 9.6, 9.7, 9.8)
-
With OpenJDK 17
- RHEL (8.10, 9.6, 9.7, 9.8)
sudo yum install -y java-17-openjdk - SLES (15 SP7, 16)
sudo zypper install -y java-17-openjdk-devel - Ubuntu (22.04, 24.04)
sudo apt-get install -y openjdk-17-jdk
- RHEL (8.10, 9.6, 9.7, 9.8)
-
With OpenJDK 21
- RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
sudo yum install -y java-21-openjdk - SLES (15 SP7, 16)
sudo zypper install -y java-21-openjdk-devel - Ubuntu (22.04, 24.04)
sudo apt-get install -y openjdk-21-jdk
- RHEL (8.10, 9.6, 9.7, 9.8, 10.0, 10.1, 10.2)
Note: Versions (v8.0.422.0, v11.0.21, v17.0.15 and v21.0.1.0) of IBM Semeru Runtime and (1.8.0_8u282b08, v11.0.21, v17.0.9, 21.0.2) of Adoptium Temurin Runtime were used at the time of creation of these instructions.
3. Set environment variables
export JAVA_HOME=<path to Java installation directory>
export PATH=$JAVA_HOME/bin:$PATH
4. Basic validation test (Optional)
To validate the installation, refer here.