ubuntu:/# mkdir jdk
ubuntu:/# cd /jdk
ubuntu:/# chmod 777 jdk
ubuntu:/# cd /jdk
ubuntu:/jdk# rz
rz waiting to receive.
ubuntu:/jdk# ls
jdk-8u291-linux-x64.tar.gz
ubuntu:/jdk# tar xf jdk-8u291-linux-x64.tar.gz
ubuntu:/jdk# ls
jdk1.8.0_291 jdk-8u291-linux-x64.tar.gz
ubuntu:/jdk# cd
ubuntu:~# sudo vi /etc/profile
加入: (按 insert 输入 ,按 esc :wq 保存退出)
export JAVA_HOME=/jdk/jdk1.8.0_291
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
如:
配置生效:
ubuntu:/# cd /
ubuntu:/# source /etc/profile
查看:
ubuntu:/# java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
ubuntu:/#