How To Install Java and Java SE Development Kit on AlmaLinux 9

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

Today, you will learn how To Install Java and Java SE Development Kit on AlmaLinux 9

Install Java on AlmaLinux:

Follow the steps below to get started with Java:

  • Update your AlmaLinux system packages with running the below command:
sudo dnf clean all && sudo dnf update
sudo dnf groupinstall "Development Tools"
  • Java package is not available on AlmaLinux base repository. So You can run the following command to download OpenJDK installer to your AlmaLinux system as follows:

wget https://download.java.net/java/GA/jdk18.0.2/f6ad4b4450fd4d298113270ec84f30ee/9/GPL/openjdk-18.0.2_linux-x64_bin.tar.gz
java almalinux
  • Extract the downloaded file then move the extracted files to /mnt directory.
tar xvf openjdk-18.0.2_linux-x64_bin.tar.gz
sudo mv jdk-18.0.2 /mnt/
  • After that, configure the Java environment by editing the file below :
sudo vim /etc/profile.d/jdk18.sh 

Then add the following:

export JAVA_HOME=/opt/jdk-18
export PATH=\$PATH:\$JAVA_HOME/bin
  • Check the java command:
source /etc/profile.d/jdk18.sh
  • Also try to verify the OpenJDK installation by running the command below:
echo $JAVA_HOME

Install Java SE Development Kit on AlmaLinux:

  • Java SE Dev Kit package is not available on RHEL base repository. So You can download it with the following command:
wget https://download.oracle.com/java/19/latest/jdk-19_linux-aarch64_bin.rpm
java almalinux
  • Then install the Java SE Dev Kit as shown below:
sudo rpm -Uvh jdk-19_linux-aarch64_bin.rpm
  • Verify the installation:
java -version

After that, configure the Java environment by editing the file below :

sudo vim /etc/profile.d/jdk18.sh

Then add the following:

export JAVA_HOME=/usr/java/default
export PATH=\$PATH:\$JAVA_HOME/bin

Check the java command:

source /etc/profile.d/jdk18.sh

NOTE:

If you have multiple versions of Java, you can use the command below to manage the version you want:

sudo alternatives --config java

Conclusion

That’s it

Thanks.

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook