错误:找不到libjava.so,错误:找不到Java 2 Runtime Environment

时间:2021-11-28 14:10:06

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

我在我的Linux服务器上卸载java j2sdk1.4.2_12 java并安装jdk1.6.0_21,但是当我尝试运行任何脚本时,我得到以下错误

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

I already set classPath and Path like :

我已经将classPath和Path设置为:

In vi ~/.bashrc

在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

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 ?

我不知道问题在哪里。谁能帮我 ?

1 个解决方案

#1


1  

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

我之前遇到过这个问题。事实证明我的机器上有2个javac程序。它们位于/ usr / bin / javac和/ bin / javac中。我的系统使用了/ bin / javac。我的正确道路是/ usr / bin / javac。删除/ bin / javac有帮助

#1


1  

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

我之前遇到过这个问题。事实证明我的机器上有2个javac程序。它们位于/ usr / bin / javac和/ bin / javac中。我的系统使用了/ bin / javac。我的正确道路是/ usr / bin / javac。删除/ bin / javac有帮助