Abidi
Abidi

Reputation: 8006

Java libjava.so file error

It's been a day since I am trying to get "java" command run on a server, that has java5 jre installed. Problem is I always get

Error: could not find libjava.so Error: could not find Java 2 Runtime Environment.

even if I run it from the installation directory, /usr/lib/java1.5/jre/bin. I can see libjava.so is in ../jre/lib/amd64 directory but not sure why wouldn't it get picked up. Any hints would be greatly appreciated.

-Thanks

Upvotes: 3

Views: 14682

Answers (1)

Dunes
Dunes

Reputation: 40853

Very weird error. I noticed you're using a 64-bit OS. Found this link that talks of a problem between older versions of java and 64-bit OSes. Java 1.5 was released 2004 and 64-bit processors were only introduced to mainstream computer market in 2003. Meaning this could be a likely culprit.


For posterity (in case the page gets deleted):

This problem refer to the installation of old JDKs on 64bit Linux systems. When java command is executed at shell, generally, you will receive this error message:

Error: can't find libjava.so.

To solve this problem just edit 3 files located at JDK installation dir and be happy

  • $JAVA_HOME/bin/.java_wrapper
  • $JAVA_HOME/jre/bin/.java_wrapper
  • $JAVA_HOME/jre/bin/realpath

All these 3 files have similar code snippet as bellow:

case "`uname -m`" in
    i[3-6]86 | ia32 | ia64 | i?86)
        proc=i386
        ;;
    sparc*)
        proc=sparc
        ;;
    *)
        proc=unknown
        ;;
esac

Edit each file and include the architecture x86_64 in the first case-statement and the problem will be fixed:

    i[3-6]86 | ia32 | ia64 | i?86 | x86_64)

Upvotes: 3

Related Questions