Linux配置JDK环境

1、下载jdk压缩包

https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

2、解压

tar -zxvf jdk-8u191-linux-x64.tar.gz /opt/jdk

3、设置环境变量

vim ~/.bashrc

内容:

1
2
3
4
5
export JAVA_HOME=/opt/jdk

export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

export PATH=$PATH:$JAVA_HOME/bin

4、立即生效环境变量

source ~/.bashrc