Tuesday, 5 November 2024

How to Install JDK 23 on Linux OS or Amazon EC2 | JDK 23 Installation on Linux OS or EC2

🚀 Master Java & AWS!

Subscribe to Ram N Java for the most simplified tech tutorials!

SUBSCRIBE TO OUR CHANNEL

How to Install JDK 23 on Linux or Amazon EC2

Setting up JDK 23 on a Linux server or an Amazon EC2 instance is a core skill for any developer. This guide will walk you through the process step-by-step, from updating your system to verifying your installation.

Step 1: Update Your Linux System

Before installing new software, it's a best practice to ensure your existing packages are up to date. Run these commands in your terminal:

sudo yum update -y
sudo yum upgrade -y

Step 2: Download the JDK 23 Archive

Visit the Oracle JDK download page and copy the link for the Linux x64 Compressed Archive. Then, use the wget command to download it directly to your server:

wget [PASTE_THE_DOWNLOAD_LINK_HERE]

Step 3: Extract the JDK

Once the download is complete, extract the files to the /opt directory, which is the standard place for optional software packages:

sudo tar -xvf jdk-23_linux-x64_bin.tar.gz -C /opt

Step 4: Set Environment Variables

To make Java available system-wide, you need to set the JAVA_HOME and PATH variables. Open the /etc/profile file:

sudo nano /etc/profile

Add these lines at the end of the file:

export JAVA_HOME=/opt/jdk-23.0.1
export PATH=$PATH:$JAVA_HOME/bin

Then, apply the changes with: source /etc/profile

Step 5: Verify the Installation

Finally, check if everything is working by checking the Java version:

java -version
javac -version

📥 Download Free Resources!

I've included the PowerPoint presentation and Java source code for this tutorial in the video description on YouTube. Head over there to grab your copies!

No comments:

Post a Comment

Tutorials