1.下载jdk8
登录网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# cd /usr/local
# vim /etc/profile
添加如下内容:
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
或
执行命令 # source /etc/profile
# java -version
显示如下内容:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
参考网址:http://blog.csdn.net/rchm8519/article/details/48721913
登录网址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
选择对应jdk版本下载。(可在Windows下下载完成后,通过xftp等软件复制到到Linux上)
# cd /usr/local
# mkdir java
# cp /mnt/hgfs/linux/jdk-8u60-linux-x64.tar.gz /usr/java/
# tar -zxvf jdk-8u60-linux-x64.tar.gz
# ln -s /usr/local/java/jdk1.8.0_60/ /usr/jdk
# vim /etc/profile
添加如下内容:
JAVA_HOME=/usr/jdk
CLASSPATH=$JAVA_HOME/lib/
PATH=$PATH:$JAVA_HOME/bin
export PATH JAVA_HOME CLASSPATH
保存退出:wq
或
执行命令 # source /etc/profile
让环境变量立即生效!
# java -version
显示如下内容:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
参考网址:http://blog.csdn.net/rchm8519/article/details/48721913