Java libjava.so 文件错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9701348/
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
Java libjava.so file error
提问by Abidi
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
自从我试图在安装了 java5 jre 的服务器上运行“java”命令以来已经有一天了。问题是我总是得到
Error: could not find libjava.so Error: could not find Java 2 Runtime Environment.
错误:找不到 libjava.so 错误:找不到 Java 2 运行时环境。
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.
即使我从安装目录 /usr/lib/java1.5/jre/bin 运行它。我可以看到 libjava.so 在 ../jre/lib/amd64 目录中,但不确定为什么它不会被拾取。任何提示将不胜感激。
-Thanks
-谢谢
回答by Dunes
Very weird error. I noticed you're using a 64-bit OS. Found this linkthat 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.
很奇怪的错误。我注意到您使用的是 64 位操作系统。发现此链接讨论了旧版本的 java 和 64 位操作系统之间的问题。Java 1.5 于 2004 年发布,64 位处理器直到 2003 年才被引入主流计算机市场。这意味着这可能是罪魁祸首。
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:
此问题是指在 64 位 Linux 系统上安装旧 JDK。在shell执行java命令时,一般会收到这样的错误信息:
Error: can't find libjava.so.
错误:找不到 libjava.so。
To solve this problem just edit 3 files located at JDK installation dir and be happy
要解决此问题,只需编辑位于 JDK 安装目录中的 3 个文件即可
- $JAVA_HOME/bin/.java_wrapper
- $JAVA_HOME/jre/bin/.java_wrapper
- $JAVA_HOME/jre/bin/realpath
- $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:
所有这 3 个文件都有类似的代码片段,如下所示:
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:
编辑每个文件并将架构 x86_64 包含在第一个 case-statement 中,问题将得到解决:
i[3-6]86 | ia32 | ia64 | i?86 | x86_64)