1、下载JDK8
wget http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"
2、安装配置
解压:
tar -zxvf jdk-8u5-linux-x64.tar.gz mv jdk1.8.0_60 /usr/local/
配置:
修改/etc/profile
vim /etc/profile
文件内追加如下:
export JAVA_HOME=/usr/local/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
执行命令
source /etc/profile sudo update-alternatives --install /usr/bin/java java /usr/local/jdk1.8.0_60/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac /usr/local/jdk1.8.0_60/bin/javac 300 sudo update-alternatives --install /usr/bin/jar jar /usr/local/jdk1.8.0_60/bin/jar 300 sudo update-alternatives --install /usr/bin/javah javah /usr/local/jdk1.8.0_60/bin/javah 300 sudo update-alternatives --install /usr/bin/javap javap /usr/local/jdk1.8.0_60/bin/javap 300
时间: 2024-11-08 15:38:29