Cent Os 安装 java 环境 jdk

1.从下面的地址下载最新的JDK 6
http://www.oracle.com/technetwork/java/javase/downloads/
Cent OS 用得是 jdk-6u31-linux-i586.bin

2.运用ftp下载到CentOs 中,我的目录是 /usr/java/
注意下载的时候 要将ftp的传输方式 改为 二进制
命令 : bin

3.安装 jdk
./jdk-6u31-linux-i586.bin

4.更改 /etc/profile 文件
在末尾追加以下信息
JAVA_HOME=/usr/java/jdk1.6.0_31/
JRE_HOME=/usr/java/jdk1.6.0_31/jre/
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

5.将信心导入
命令 : source /etc/profile

6.测试
java -version


上面2 中如果没有更改ftp的传输方式的话会出现以下错误
The download file appears to be corrupted.  Please refer
to the Troubleshooting section of the Installation
Instructions on the download page for more information.
Please do not attempt to install this archive file.



猜你喜欢

转载自lvze1983.iteye.com/blog/1458411