1.到oracle去下载源码: jdk-8u121-linux-x64.tar.gz http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
解压:tar zvxf jdk-8u121-linux-x64.tar.gz
2.sudo mkdir /usr/lib/jvm 创建目录
3.sudo mv jdk1.8.0_20/ /usr/lib/jvm/ 将jdk文件移到/usr/lib/jvm目录下
4.设置JDK环境变量
sudo vim ~/.profile 添加以下代码:
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_121/
export JRE_HOME=/usr/lib/jvm/jdk1.8.0_121/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
网友评论