" / usr / bin / javac:/ll/ld-linux.so.2:错误的ELF解释器:没有这样的文件或目录"

时间:2018-04-06 07:17:34

标签: linux java-8

我在linux服务器RHEL 7中安装了jdk1.8.0_161。由于" / usr / bin / javac:/lib/ld-linux.so.2,我无法检查java版本:错误的ELF解释器:没有这样的文件或目录"

以下是我安装jdk后的步骤,

cd /opt/jdk1.8.0_161/
alternatives --install /usr/bin/java java /opt/jdk1.8.0_161/bin/java 2
alternatives --config java

There is 1 program that provides 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /opt/jdk1.8.0_161/bin/java

Enter to keep the current selection[+], or type selection number: 1

alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_161/bin/jar 2
alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_161/bin/javac 2
alternatives --set jar /opt/jdk1.8.0_161/bin/jar
alternatives --set javac /opt/jdk1.8.0_161/bin/javac

java -version
-bash: /usr/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory


export JAVA_HOME=/opt/jdk1.8.0_161
export JRE_HOME=/opt/jdk1.8.0_161/jre
export PATH=$PATH:/opt/jdk1.8.0_161/bin:/opt/jdk1.8.0_161/jre/bin

1 个答案:

答案 0 :(得分:2)

看起来你在/ opt /中解压缩了tar.gz文件。这个版本显然试图使用32位/lib/ld-linux.so.2。 (64位链接器为/usr/lib64/ld-linux-x86-64.so.2 -> ld-2.17.so

对于EL7,请使用“rpm”8u 162 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html→   jdk-8u162-linux-x64.rpm

# cd Downloads/ && yum install ./jdk-8u162-linux-x64.rpm

# alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_162/bin/java 2
# alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_162/bin/javac 2

# alternatives --config java
# alternatives --config javac

没问题......