简体   繁体   中英

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

I uninstalled java j2sdk1.4.2_12 java on my Linux Server and Install jdk1.6.0_21, but when I am trying to run any script I am getting following Error

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

I already set classPath and Path like :

In vi ~/.bashrc

export JAVA_HOME=/home/java/jdk1.6.0_21/
export PATH=$PATH:/home/java/jdk1.6.0_21/bin
export set CLASSPATH=/usr/java/j2sdk1.4.2_12/lib/mysql-connector-java-5.1.6-bin.jar:    /home/java/jdk1.6.0_21/jre/lib:/root/mis/mod:$CLASSPATH

ulimit -c unlimited

IN vi ~/.bash_profile

JAVA_HOME=/home/java/jdk1.6.0_21/
PATH=$PATH:$HOME/bin:$HOME/mis/mod:
PATH=/home/java/jdk1.6.0_21/bin:$PATH
CLASSPATH=$CLASSPATH:/home/java/jdk1.6.0_21/lib:.:
export JAVA_HOME
export PATH
export CLASSPATH
unset USERNAME

When I run following Commands

which java

/home/java/jdk1.6.0_21/bin/java

java -version

java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

I am not getting where is the issue. Can Any one help me ?

I encounter this issue before. It turns out there are 2 javac program sitting on my machine. They are in /usr/bin/javac and /bin/javac . My system used the /bin/javac one. The right path for me is /usr/bin/javac . Removing /bin/javac helped

I faced the same issue, and it disppeared by just shutting down the CentOS VM and then starting again. Then type in javac command again to check.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM