Linux 安装与配置JDK1.7.0_55
1.环境:
# lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 5.8 (Final)
Release: 5.8
Codename: Final
2.下载JDK地址:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
3.安装JDK
上传已经下载好的java至服务器;
# mkdir /usr/java
# rpm -ivh rpm -ivh jdk-7u55-linux-x64.rpm
4.环境变量设置
所有用户:
cat /etc/profile.d/java.sh
#set java environment
JAVA_HOME=/usr/java/jdk1.7.0_55
JAVA_BIN=/usr/java/jdk1.7.0_55/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_BIN:$PATH
export PATH JAVA_HOME CLASSPATH
chmod 755 /etc/profile.d/java.sh
单用户:
$HOME/.bash_profile文件
5.校验
# java -version
java version “1.7.0_55”
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
# javac
# java
本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-05/101052.htm