首页 技术 正文
技术 2022年11月16日
0 收藏 864 点赞 4,680 浏览 2253 个字

今天在服务器上装JDK1.5,费了不少力气,记录下来以供参考

服务器安装的操作系统为Red Hat 6.1(x86)

[123@123 bin]$ cat /etc/redhat-release
Red Hat Enterprise Linux Workstation release 6.1 (Santiago)
[123@123 ~]$ uname -op
x86_64 GNU/Linux

由于项目使用JDK1.5编译,故在安装JDK时首先选则的jdk-1_5_0_22-linux-i586.bin:

Do you agree to the above license terms? [yes or no]
yes
Unpacking...
Checksumming...
0
0
Extracting...
./jdk-1_5_0_15-linux-i586.bin: ./install.sfx.2991: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
mkdir: cannot create directory `jdk1.5.0_15/jre': No such file or directory
mkdir: cannot create directory `jdk1.5.0_15/jre/.systemPrefs': No such file or directory
touch: cannot touch `jdk1.5.0_15/jre/.systemPrefs/.system.lock': No such file or directory
chmod: cannot access `jdk1.5.0_15/jre/.systemPrefs/.system.lock': No such file or directory
touch: cannot touch `jdk1.5.0_15/jre/.systemPrefs/.systemRootModFile': No such file or directory
chmod: cannot access `jdk1.5.0_15/jre/.systemPrefs/.systemRootModFile': No such file or directory
./jdk-1_5_0_15-linux-i586.bin: line 680: cd: jdk1.5.0_15: No such file or directoryDone.

搜索了一下/lib/ld-linux.so.2: bad ELF interpreter这个错误,很多地方提示安装glib(一个跨平台的、用c语言编写的库)即可解决,不过我没尝试过

剩余的选择不多,既然32位JDK1.5无法安装,尝试下64位JDK1.5

选择jdk-1_5_0_22-linux-amd64.bin再次尝试,安装成功,但是在运行时会提示找不到java.lang.Object

[123@123 bin]$ ./java -version
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

在jdk1.5.0_11/jre/lib目录下竟然没有rt.jar!

查了下有人自己上传rt.jar解决了这个问题,手头上没有64位的rt.jar,用32位的尝试了下,果然是不行的

[123@123 bin]$ ./java -version
Error occurred during initialization of VM
java.lang.UnsatisfiedLinkError: set

其实这是一个很明显的错误,安装包上明确写着amd64,即这是专门为amd64架构的处理器使用的

[123@123 ~]$ cat /proc/cpuinfo|grep 'model name'
model name      : Intel(R) Xeon(R) CPU           E5620  @ 2.40GHz

服务器上的英特尔Xeon E5620处理器使用的是Intel64(EM64T)架构

万般无奈下,考虑到JDK版本向下兼容,最终选择了1.6版本的JDK

比起JDK1.5,JDK1.6安装包的名称更清晰易懂(直接使用x64,不再区分amd64与intel64),选择安装jdk-6u45-linux-x64.bin,没有问题:

[123@123 web]$ ./jdk1.6.0_45/bin/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)

当然如果选择jdk-6u45-linux-i586.bin应该也是没有问题的

特别需要注意的是Red Hat 6.1(x86)中自带的JDK为OpenJDK而非Java(TM)

[123@123 ~]$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.7) (rhel-1.39.1.9.7.el6-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

这两个JDK还是有一定差异的,在Java(TM)环境下编译并能正常运行的程序在OpenJDK环境下不一定能正常运行

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,080
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,554
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,403
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,178
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898