linux 安装jdk
卸载自带jdk
[weblogic@localhost root]$ rpm -qa | grep jdk
java-1.7.0-openjdk-headless-1.7.0.51-2.4.5.5.el7.x86_64
java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64
[weblogic@localhost root]$ rpm -e java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64
错误:依赖检测失败:
java >= 1.5 被 (已安裝) jline-1.0-8.el7.noarch 需要
java-1.7.0-openjdk 被 (已安裝) icedtea-web-1.4.2-1.el7.x86_64 需要
强制卸载
[weblogic@localhost root]$ rpm -e --nodeps java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64
错误:can't create 事务 lock on /var/lib/rpm/.rpm.lock (权限不够)
[weblogic@localhost root]$ su root
密码:
[root@localhost ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64
[root@localhost ~]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.51-2.4.5.5.el7.x86_64
提前下载好jdk 然后放在/usr/jdk目录下
[root@localhost ~]# cd /usr/jdk
[root@localhost jdk]# ll
-rw-r--r--. 1 root root 68881069 8月 17 16:58 jdk-6u45-linux-x64-rpm.bin
注意rpm.bin不能使用rpm命令安装 而是通过./的方式安装的。
[root@localhost jdk]# rpm -i jdk-6u45-linux-x64-rpm.bin
错误:jdk-6u45-linux-x64-rpm.bin: 不是 rpm 软件包 (或者没有manifest):
[root@localhost jdk]# chmod 755 jdk-6u45-linux-x64-rpm.bin
[root@localhost jdk]# ./jdk-6u45-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
inflating: jdk-6u45-linux-amd64.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
准备中... ################################# [100%]
正在升级/安装...
1:jdk-2000:1.6.0_45-fcs ################################# [100%]
Unpacking JAR files...
rt.jar...
jsse.jar...
charsets.jar...
tools.jar...
localedata.jar...
plugin.jar...
javaws.jar...
deploy.jar...
Installing JavaDB
准备中... ################################# [100%]
正在升级/安装...
1:sun-javadb-common-10.6.2-1.1 ################################# [ 17%]
2:sun-javadb-core-10.6.2-1.1 ################################# [ 33%]
3:sun-javadb-client-10.6.2-1.1 ################################# [ 50%]
4:sun-javadb-demo-10.6.2-1.1 ################################# [ 67%]
5:sun-javadb-docs-10.6.2-1.1 ################################# [ 83%]
6:sun-javadb-javadoc-10.6.2-1.1 ################################# [100%]
Done.
[root@localhost jdk]# java -ersion
Unrecognized option: -ersion
Could not create the Java virtual machine.
[root@localhost jdk]# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
[root@localhost jdk]# rpm -qa | grep jdk
jdk-1.6.0_45-fcs.x86_64
安装jdk成功。
useradd weblogic
passwd weblogic