1、
检查
系
统
自
带
的
jdk
信息
[root@localhost ~]#
rpm -qa|grep java
java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
2、
删除
JDK
[root@localhost ~]#
rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115
3、
确认系统已经没有
jdk
[root@localhost ~]#
java -version
bash: java: command
not found
4、
安装
JDK
[root@localhost ~]#
cd /usr/tmp
[root@localhost
tmp]# ls
apache-tomcat-6.0.32.tar.gz
VMwareTools-7.8.5-156735.tar.gz
httpd-2.2.19.tar.gz
vmware-tools-distrib
jdk-6u26-linux-i586-rpm.bin
5、
准备将
JDK
安装在
/usr
目录下,所以先拷贝
jdk
到该目录
[root@localhost
tmp]# cp jdk-6u26-linux-i586-rpm.bin /usr
[root@localhost
tmp]# cd ..
[root@localhost
usr]# ls
bin
games
jdk-6u26-linux-i586-rpm.bin
lib
local
share
tmp
etc
include
kerberos
libexec
sbin
src
X11R6
6、
给
所有用
户
添加可
执
行的
权
限
[root@localhost
usr]# chmod +x jdk-6u26-linux-i586-rpm.bin
7、
执行
jdk
安装文件,
此
时
会生成文件
jdk-6u26-linux-i586.rpm
[root@localhost
usr]# ./jdk-6u26-linux-i586-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17
February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u26-linux-i586.rpm
inflating:
sun-javadb-common-10.6.2-1.1.i386.rpm
inflating:
sun-javadb-core-10.6.2-1.1.i386.rpm
inflating:
sun-javadb-client-10.6.2-1.1.i386.rpm
inflating:
sun-javadb-demo-10.6.2-1.1.i386.rpm
inflating:
sun-javadb-docs-10.6.2-1.1.i386.rpm
inflating:
sun-javadb-javadoc-10.6.2-1.1.i386.rpm
Preparing...
########################################### [100%]
1:jdk
###########################################
[100%]
Unpacking JAR
files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
Preparing...
########################################### [100%]
1:sun-javadb-common
########################################### [ 17%]
2:sun-javadb-core
########################################### [ 33%]
3:sun-javadb-client
########################################### [ 50%]
4:sun-javadb-demo
########################################### [ 67%]
5:sun-javadb-docs
########################################### [ 83%]
6:sun-javadb-javadoc
########################################### [100%]
Java(TM) SE
Development Kit 6 successfully installed.
Product Registration
is FREE and includes many benefits:
* Notification of
new versions, patches, and updates
* Special offers on
Oracle products, services and training
* Access to early
releases and documentation
Product and system
data will be collected. If your configuration
supports a browser,
the JDK Product Registration form will
be presented. If you
do not register, none of this information
will be saved. You
may also register your JDK later by
opening the
register.html file (located in the JDK installation
directory) in a
browser.
For more information
on what data Registration collects and
how it is managed
and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to
continue.....
Done.
[root@localhost
usr]# ls
bin
sbin
etc
share
games
src
include
sun-javadb-client-10.6.2-1.1.i386.rpm
java
sun-javadb-common-10.6.2-1.1.i386.rpm
jdk-6u26-linux-i586.rpm
sun-javadb-core-10.6.2-1.1.i386.rpm
jdk-6u26-linux-i586-rpm.bin
sun-javadb-demo-10.6.2-1.1.i386.rpm
kerberos
sun-javadb-docs-10.6.2-1.1.i386.rpm
lib
sun-javadb-javadoc-10.6.2-1.1.i386.rpm
libexec
tmp
local
X11R6
8、
将
jdk-6u26-linux-i586.rpm
给所有用户分配执行权限
[root@localhost usr]#
chmod +x jdk-6u26-linux-i586.rpm
9、
执行
rpm
文件,提示
jdk
已经被安装成功。按照其他的手顺应该是到这一步才算安装成功,不知道是不是最新版本直接执行
bin
文件时就直接安装成功了,这个目前不太清楚。
[root@localhost
usr]# rpm -ivh jdk-6u26-linux-i586.rpm
Preparing...
########################################### [100%]
package jdk-1.6.0_26-fcs is already
installed
10、
测试
java
,
javac
命令是否可用。
[root@localhost
usr]# java -version
java version
"1.6.0_26"
Java(TM) SE Runtime
Environment (build 1.6.0_26-b03)
Java HotSpot(TM)
Client VM (build 20.1-b02, mixed mode, sharing)
如果要让
jdk
让所有用户使用,必须在
etc/profile
中只是环境变量:
设
置
环
境
变
量
。
#vim
/etc/profile
在最后面加入
#set
java
environment
JAVA_HOME=/usr/java/jdk1.6.0_26
CLASSPATH=.:
$
JAVA_HOME/lib.tools.jar
PATH=
$
JAVA_HOME/bin:
$
PATH
export
JAVA_HOME CLASSPATH PATH
保存退出。
分享到:
相关推荐
本TXT文件为第一章:Linux 下安装 JDK 测试环境:系统 CentOS 5.2 第一步:查看Linux自带的JDK是否已安装并卸载…… 第二步:安装JDK步骤…… 第三步:配置环境变量 三步完成安装 其他安装请见...
jdk1.6 Linux/Centos都可以用 这是从官网下载的 请放心使用
jdk1.6.0_45,Linux 64位,Ubuntu 或者 CentOS 均可,亲测,解压即可用 (解压命令 tar -xf xxxxx.tar.gz), 配置环境变量 /etc/profile (非必要操作,因为 IDEA 可以直接选择 1.6 所在目录,无需添加环境变量) ...
CentOS7下安装JDK1.8详细过程
本TXT文件为第二章Linux 下安装 Tomcat5.5 测试环境:系统 CentOS 5.2 Tomcat版本apache-tomcat-5.5.23 第一步:解压缩Tomcat部署文件到 /usr/local/tomcat 第二步:测试安装(注意环境变量JAVA_HOME必需...
CentOS 5.2 下安装 FreePBX 2.5.0
NULL 博文链接:https://yy-web.iteye.com/blog/272348
Centos6.5安装jdk,里面有jdk1.6、jdk1.7、jdk1.8,均64位
手把手教你在Centos6.6下安装JDK1.7(Linxu)图文详解,适合初学者,入门经典案例...
centos6.7安装jdk1.8全部详细过程,若有疑问,欢迎联系!
CentOS环境下安装JDK及一些安装问题的
在centos,redhat等linux系统上安装的linux版本的jdk1.6
最小服务安装,图示安装,适合初学者,分区按照最简模式
linux centos5.2图形安装手册
CentOS7下安装JDK1.8详细过程
CentOS5.2系统安装在虚拟机上,编译gcc.pdf
Centos 5.2 下 ORACLE 10G安装
CentOS中架设jdk1.6+mysql+glassfishV3(tomcat6).pdf
linux系统下1.6jdk安装,以每一步的详细命令,及环境变量的配置
Linux(centOS5.2)图文教程 自己编写,希望对你有帮助