安装jdk步骤:
1.1卸载系统自带的openjdk
[root@localhost ~]# rpm -qa | grep java
[root@localhost ~]# yum -y remove *openjdk*
1.2下载、安装
在Oracle官网http://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html找到我们需要的JDK版本,下载对应的rpm包后上传到服务器,然后进行安装:
[root@localhost ~]# rpm -ivh jdk-8u162-linux-x64.rpm
1.3配置环境变量
[root@localhost ~]# vim /etc/profile
在文件后面添加如下配置
JAVA_HOME=/usr/java/jdk1.8.0_162
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
保存并退出
刷新修改后的配置文件
[root@localhost ~]# source /etc/profile
1.4检查是否安装成功
[root@localhost ~]# java -version
[root@localhost ~]# java
[root@localhost ~]# javac
---------------------
作者:ZHU_WD
来源:CSDN
原文:https://blog.csdn.net/zhu815496402/article/details/80357400
版权声明:本文为博主原创文章,转载请附上博文链接!
[root@test ~]# rpm -ivh jdk-7u55-linux-i586.rpm
Preparing... ########################################### [100%]
1:jdk ########################################### [100%]
Unpacking JAR files...
rt.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/rt.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
jsse.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/jsse.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
charsets.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/charsets.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
tools.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/lib/tools.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
localedata.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/ext/localedata.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
jfxrt.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/jfxrt.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
plugin.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/plugin.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
javaws.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/javaws.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
deploy.jar...
/var/tmp/rpm-tmp.dTi5eF: /usr/java/jdk1.7.0_55/bin/unpack200: /lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
Error: unpack could not create JAR file:
/usr/java/jdk1.7.0_55/jre/lib/deploy.jar
Please refer to the Troubleshooting section of the Installation Instructions
on the download page.
原因:
64位系统中安装了32位程序。
解决方法:
运行以下命令:
[root@test ~]# yum install libgcc.i686
[root@test ~]# yum install ld-linux.so.2
再重新安装JDK