错误:找不到 libjava.so,错误:找不到 Java 2 运行时环境
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25954348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: could not find libjava.so, Error: could not find Java 2 Runtime Environment
提问by Krishna Roy
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
和路径如下:
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
在 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
哪个java
/home/java/jdk1.6.0_21/bin/java
java -version
java - 版本
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 ?
我不明白问题出在哪里。谁能帮我 ?
回答by user2829759
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
帮助
回答by Vignesh Menon
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.
我遇到了同样的问题,只需关闭 CentOS 虚拟机然后重新启动它就消失了。然后再次输入 javac 命令进行检查。