How to install Jdk on linux


system version
System version: RedHat7.5
Jdk version: java version "17.0.1"
Download Jdk
Download link:https://download.oracle.com/java/17/archive/jdk-17.0.1_linux-x64_bin.tar.gz
Other versions:https://www.oracle.com/java/technologies/downloads/archive/
Server creation directory
mkdir -p /home/local/java
Copy files to the server
 scp /c/Users/cmdhelp/Desktop/jdk-17.0.1_linux-x64_bin.tar.gz root@192.168.254.155/home/local/java
unzip files
 tar -zxvf jdk-8u271-linux-x64.tar.gz
Configure environment variables
vim /etc/profile
Add content at the end
export JAVA_HOME=/home/local/java/jdk-17.0.1
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
File takes effect
source /etc/profile
Test whether Jdk is installed successfully
javac
java



Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.