Home > 学习 | 工作 > JAVA:cannot execute binary file

JAVA:cannot execute binary file

配置新系统时,直接在其他机器上将jdk文件夹整个scp过来,然后配置环境变量:

vim /etc/profile

export JAVA_HOME=/opt/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export CLASSPATH=$CLASSPATH:$CATALINA_HOME/common/lib

再运行java -verison命令查看jdk信息时,报出如下错误:

-bash: /opt/jdk/bin/java: cannot execute binary file

以为是scp后文件出现问题了,准备zip打包后重新传一遍,但突然想起用md5sum命令校验一遍文件更为方便:

[root@localhost bin]# md5sum java
a0a2a95c73ee4de20bf0501b76b94901  java

[root@KS-81 bin]# md5sum java
a0a2a95c73ee4de20bf0501b76b94901  java

两台服务器的java文件md5值完全相同,说明文件没有被改变,那应该是系统问题了,源服务器是centos5.6的系统,新服务器是centos6.2的系统,照理说没有区别,uname后发现问题所在了:

[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-220.el6.i686 #1 SMP Tue Dec 6 16:15:40 GMT 2011 i686 i686 i386 GNU/Linux

[root@KS-81 ~]# uname -a
Linux KS-81 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

源服务器KS-81是64位系统,而新服务器localhost是32位系统!cannot execute binary file报错原因100%是操作系统位数不同造成的!

同理,如果是编译安装jdk的时候,一定要选与系统位数一样的版本(i386还是X86_64).

原创文章,转载请注明: 转载自三叶草

本文链接地址:http://www.anjing.me/1372.html

特别声明:商业网站转载需经作者同意,否则视为侵权!

相关日志

POSTED ON 2012/03/08, , ,

Comments:2

Leave my own
  1. #1 Binary Today
    18/01/26 回复

    Your personal take on options trading is perfectly thought out, I am going to share this with my subscribers.

  2. #2 www.binarytoday5.com
    18/09/12 回复

    We should have a talk some time on the subject of options and what we’re able to do to helps it be greater for
    any one.

Leave a Reply

TOP