Java html
安裝環境:CentOS-6.5
安裝方式:rpm安裝
軟件:jdk-7u80-linux-x64.rpm
安裝位置:/usr/java
下載地址:1. http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.htmljava
# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
# rpm -qa | grep java
java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
tzdata-java-2013g-1.el6.noarch
# rpm -e --nodeps tzdata-java-2013g-1.el6.noarch
# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
上傳jdk-7u80-linux-x64.rpm軟件至服務器中,執行如下操做:node
# rpm -ivh jdk-7u80-linux-x64.rpm
注:JDK默認安裝在/usr/java中linux
修改系統環境變量文件vim
# vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.7.0_80
export JRE_HOME=/usr/java/jdk1.7.0_80/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
若是拷貝的直接是JDK文件到Linux服務器上面的話,記得修改bin目錄下的可執行文件服務器
# chmod 751 /usr/local/jdk/bin/*
# source /etc/profile //使修改當即生效
# echo $PATH //查看PATH值
# echo $PATH
/usr/java/jdk1.7.0_80/bin:/usr/java/jdk1.7.0_80/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# java
# javac
# java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)