Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed openjdk-1.7.0-devel in my centos box, however, everytime I run java --version, I get:

java: error while loading shared libraries: cannot open shared object file: No such file or directory

I've already tried downloading the rpm file from oracle website and still get the error, any ideas?

If I try to locate the file it appears in a few locations in my filesystem, so I'm sure it's there.

share|improve this question

closed as off topic by mdpc, Ward, Khaled, faker, Scott Pack Dec 31 '12 at 1:48

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

If using CentOS 6.3, for instance, you should just try to reinstall your Java openjdk packages. There is no reason to download anything from Oracle.


yum install java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-devel.x86_64

Maybe even:

yum reinstall java-1.7.0-openjdk.x86_64 java-1.7.0-openjdk-devel.x86_64

The library you need is part of the openjdk package, and is location in: /usr/lib/jvm/java-1.7.0-openjdk- on my system.

share|improve this answer
I've already tried that and still get the error, I'm also in centos 6.3. – danielrvt Dec 30 '12 at 2:27
You tried what? – ewwhite Dec 30 '12 at 2:28
Using yum to install openjdk. My location is the same as yours, it seems that a link or reference to it is missing somewhere else. – danielrvt Dec 30 '12 at 2:35
I suggested yum reinstall... Did you do that? – ewwhite Dec 30 '12 at 2:41
Yes, I even removed it and then reinstalled also – danielrvt Dec 30 '12 at 4:17

Use this command and it will work:

# ln -s /usr/lib64/gcj-4.4.6/ /usr/lib/jvm/java-1.5.0-gcj-

If by any chance it doesn't work, then give me the output for following commands and I will update my answer:

 # ls -l /usr/lib64/
 # ls -l /usr/lib/jvm/
share|improve this answer
Used cd /lib/arm-linux-gnueabihf; ln -s /usr/lib/jvm/java-7-openjdk-armhf/lib/arm/jli/; ldconfig on an ARM device (Pelya's Debian android app, which creates a fakechroot Debian environment on an unrooted phone). This made java work for me. – transistor1 Jul 7 '14 at 17:50

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