The file exists but bash complains it doesn't when asked to execute it.

$ ./Libs/openjdk-1.8.0_60-eap/bin/java
bash: ./Libs/openjdk-1.8.0_60-eap/bin/java: No such file or directory

$ ls -l ./Libs/openjdk-1.8.0_60-eap/bin/java
-rwxr-xr-x 1 spacecamel spacecamel 7734 Mar  4 03:27 ./Libs/openjdk-1.8.0_60-eap/bin/java

I've read this problem happened when a 32bit version was executed on a 64bit system. Unfortunately it does not seem to be my case

$ file ./Libs/openjdk-1.8.0_60-eap/bin/java
./Libs/openjdk-1.8.0_60-eap/bin/java: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

$ uname -a
Linux <hostname> 3.14.34 #1-NixOS SMP Thu Jan 1 00:00:01 UTC 1970 x86_64 GNU/Linux



This is indeed a typical error relating to the wrong architecture. However, it's also indicative that the necessary libraries required to run the executable are not found.

You need to add your x86-64 libraries for the Java run-time to the LD_LIBRARY_PATH, or add the directory containing them to the directory /etc/ld.so.conf.d/. To do this, first convert your ./Libs/openjdk-1.8.0_60-eap into an absolute path. In my suggestions below I've assumed /opt/java/Libs/openjdk-1.8.0_60-eap.

Without root access (or for testing)

export LD_LIBRARY_PATH=/opt/java/Libs/openjdk-1.8.0_60-eap

With root access

sudo -s
    echo /opt/java/Libs/openjdk-1.8.0_60-eap >>/etc/ld.so.conf.d/java

You can use ldd on java to see if there are libraries missing.

You can use strace to see if a file is missing or if it is dlopen()'ing some file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.