Linux离线安装Jdk


系统版本
系统版本:RedHat7.5
Jdk版本 :java version "17.0.1"
下载Jdk:
下载地址:https://download.oracle.com/java/17/archive/jdk-17.0.1_linux-x64_bin.tar.gz
其他版本:https://www.oracle.com/java/technologies/downloads/archive/
服务器创建目录
mkdir -p /home/local/java
拷贝文件到服务器
 scp /c/Users/cmdhelp/Desktop/jdk-17.0.1_linux-x64_bin.tar.gz root@192.168.254.155/home/local/java
解压文件
 tar -zxvf jdk-8u271-linux-x64.tar.gz
配置环境变量
vim /etc/profile
末尾添加内容
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
文件生效
source /etc/profile
测试Jdk是否安装成功
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.