服务器安装的操作系统为Red Hat 6.4
[sean@localhost bin]$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
[sean@localhost bin]$ uname -p
x86_64
由于项目使用JDK1.5编译,故在安装JDK时首先选则jdk-1_5_0_22-linux-i586.bin:
yes
Unpacking...
Checksumming...
0
0
Extracting...
./jdk-1_5_0_22-linux-i586.bin: ./install.sfx.3480: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
mkdir: cannot create directory `jdk1.5.0_22/jre': No such file or directory
mkdir: cannot create directory `jdk1.5.0_22/jre/.systemPrefs': No such file or directory
touch: cannot touch `jdk1.5.0_22/jre/.systemPrefs/.system.lock': No such file or directory
chmod: cannot access `jdk1.5.0_22/jre/.systemPrefs/.system.lock': No such file or directory
touch: cannot touch `jdk1.5.0_22/jre/.systemPrefs/.systemRootModFile': No such file or directory
chmod: cannot access `jdk1.5.0_22/jre/.systemPrefs/.systemRootModFile': No such file or directory
./jdk-1_5_0_22-linux-i586.bin: line 696: cd: jdk1.5.0_22: No such file or directory
Done.
解决方式如下:
[sean@localhost bin]$ yum list installed|grep glibc
glibc.x86_64 2.12-1.107.el6
@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4
glibc-common.x86_64 2.12-1.107.el6
@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4
glibc-devel.x86_64 2.12-1.107.el6
@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4
glibc-headers.x86_64 2.12-1.107.el6
@anaconda-RedHatEnterpriseLinux-201301301459.x86_64/6.4
只安装了glibc.x86_64,缺少glibc.i686,只要重新装一下glibc就可以了
选择jdk-1_5_0_22-linux-amd64.bin,安装成功:
[sean@localhost bin]$ ./java -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
考虑到JDK版本向下兼容,1.6版本的JDK也是可以的:
安装jdk-6u45-linux-x64.bin,没有问题:
[sean@localhost 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所遇到的问题和安装32位的JDK是一样的:
[sean@localhost ~]$ ./jdk-6u45-linux-i586.bin
Unpacking...
Checksumming...
Extracting...
./jdk-6u45-linux-i586.bin: ./install.sfx.3788: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Failed to extract the files. Please refer to the Troubleshooting section of
the Installation Instructions on the download page for more information.
解决方式同jdk-1_5_0_22-linux-i586.bin
特别需要注意的是Red Hat 6.4中自带的JDK为OpenJDK而非Java(TM)
[sean@localhost ~]$ 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环境下不一定能正常运行