(原)Linux下 安装jdk8

时间:2021-04-28 15:28:32

1. 复制jdk到  /usr/local/java  

cp jdk-8u40-linux-x64.gz /usr/local/java  

 

2. 解压缩

tar xvf  jdk-8u40-linux-x64.gz

 

3. 增加环境变量

vi  /etc/profile  

在最下面加入以下内容

export JAVA_HOME=/usr/local/java/jdk1.8.0_40
export JRE_HOME=/usr/local/java/jdk1.8.0_40/jre
export PATH=$PATH:/usr/local/java/jdk1.8.0_40/bin
export CLASSPATH=./:/usr/local/java/jdk1.8.0_40/lib:/usr/local/java/jdk1.8.0_40/jre/lib

 

4.测试

java -version 

source /etc/profile