Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing and Configuring JDK on Linux Systems

Tech 1

Install JDK via Yum Package Manager

To install Java using Yum, first list available Java packages:

yum list java*

Proceed to install a specific JDK version, such as OpenJDK 8:

yum install java-1.8.0-openjdk.x86_64

After installation completes, verify the JDK installation:

java -version

Yum installs Java under /usr/lib/jvm. Configure environment variables by editing the system profile:

vi /etc/profile

Append these lines to the file:

# Java environment configuration
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME CLASSPATH PATH

Apply the changes immediately:

source /etc/profile

Manual Installation Using Downloaded JDK Archive

Download the JDK archive, for example jdk-8u281-linux-x64.tar.gz, from Oracel's website. Transfer the file to your Linux server using tools like SCP or SFTP.

Extract the archive in the target directory:

tar -xzf jdk-8u281-linux-x64.tar.gz -C /opt

Set up environment variables by editing /etc/profile:

vi /etc/profile

Add these configurations at the end:

# Java environment setup
export JAVA_HOME=/opt/jdk1.8.0_281
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

Reload the profile to activate the settings:

source /etc/profile

Confirm the installation by checking the Java version:

java -version

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.