简体   繁体   English

错误:在检查 jps 时找不到 libjava.so

[英]Error: could not find libjava.so while checking for jps

I am using centOS 6.10我正在使用 centOS 6.10

ls /usr/lib/jvm     

O/P: java-1.6.0-openjdk-1.6.0.41.X86_64 java-1.7.0-openjdk-1.7.0.181.X86_64 java-1.7.0-openjdk-1.7.0.261.X86_64 O/P:java-1.6.0-openjdk-1.6.0.41.X86_64 java-1.7.0-openjdk-1.7.0.181.X86_64 java-1.7.0-openjdk-1.7.0.261.X86_64

java -version

O/P: java version "1.7.0_181" O/P:java 版本“1.7.0_181”

while checking for jps I am getting like this,在检查 jps 时,我得到了这样的结果,

jps    

O/P: Error: could not find libjava.so Error: could not find Java SE Runtime Environment. O/P:错误:找不到 libjava.so 错误:找不到 Java SE 运行时环境。

My bashrc file be like,我的 bashrc 文件就像,

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.261.X86_64/    
export HADOOP_INSTALL=/usr/local/hadoop    
export PATH=$PATH:$HADOOP_INSTALL/bin  

I dont know why this error is popping.我不知道为什么会弹出这个错误。 I am getting frustrated because of this I am searching the solution for more than 3 days.因此,我感到很沮丧,我正在寻找解决方案超过 3 天。 Any help would be much appreciated.任何帮助将非常感激。

Thanks in advance!!提前致谢!!

I found java-related processes are sometimes quirky when it comes to libraries.我发现当涉及到库时,与 java 相关的进程有时很古怪。

First identify the path for libjava.so and confirm the lib and executable are the same, one of 32- or 64-bit:首先确定 libjava.so 的路径并确认 lib 和可执行文件相同,为 32 位或 64 位之一:

file /path/to/libjava.so /other/path/to/jps

Next, for any process like jps as an example, run this:接下来,以 jps 之类的任何进程为例,运行以下命令:

ldd /some/path/jps

The runtime link-editor should list an abs path for each lib referenced by the executable, or an error if not found.运行时链接编辑器应列出可执行文件引用的每个库的绝对路径,如果未找到,则显示错误。 When there is an error, the lib is missing or exists in a directory that's not within the link-editor's search path.出现错误时,lib 丢失或存在于链接编辑器搜索路径之外的目录中。 For normal processes, setting LD_LIBRARY_PATH usually works, but java stuff is too often quirky.对于正常进程,设置 LD_LIBRARY_PATH 通常有效,但 java 的东西往往很古怪。 Try experimenting with cmd-lines or a script, eg:尝试使用 cmd 行或脚本,例如:

#!/bin/bash
LD_LIBRARY_PATH=/usr/local/lib64 /full/path/to/jps $*

(replace /usr/local/lib64 with the leading path to libjava.so). (将 /usr/local/lib64 替换为 libjava.so 的主要路径)。 Note that an independent "export KEY=val" is not required, and would add info into the environ and gets inherited by any process that follows;请注意,不需要独立的“export KEY=val”,它会将信息添加到环境中并被随后的任何进程继承; as shown, the shell sets KEY=val only for the cmd-line.如图所示,shell 仅为命令行设置 KEY=val。

Some java-related quirks are processes that either clear the environ or reset stuff like LD_LIBRARY_PATH within their own child process(es), or call execve() with a NULL envp, and the child then fails as you describe.一些与 java 相关的怪癖是清除环境或在自己的子进程中重置诸如 LD_LIBRARY_PATH 之类的东西,或者使用 NULL envp 调用 execve() 的进程,然后子进程会按照您的描述失败。 In that case you may have to resort to moving libs to a specific dir, or modify a java-related config file which lists lib dirs.在这种情况下,您可能不得不求助于将库移动到特定目录,或修改列出 lib 目录的与 java 相关的配置文件。

Sometimes quick answers can be found with strace, made easier when limiting the output, eg:有时可以使用 strace 快速找到答案,在限制 output 时更容易,例如:

strace -f -e execve,open jps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到libjava.so,错误:找不到Java 2运行时环境 - Error: could not find libjava.so, Error: could not find Java 2 Runtime Environment 模块化OpenJDK11 Java映像在Linux上找不到动态库(例如libjava.so) - Modular OpenJDK11 Java image can't find dynamic libraries (e.g. libjava.so) on Linux Intellij 15 错误:找不到 libjava.dylib - Intellij 15 Error: could not find libjava.dylib Intellij IDEA 错误:无法在 Scala 项目中找到或加载 main class org.jetbrains.jps.cmdline.Launcher - Intellij IDEA Error: Could not find or load main class org.jetbrains.jps.cmdline.Launcher in Scala Project 使用jpexport时出错(导出jprofiler .jps文件) - Error while using jpexport ( exporting jprofiler .jps files ) 检查 Java 版本时出错:找不到 java.dll - Error when checking Java version: could not find java.dll 错误:执行jar文件时找不到或加载主类 - Error: Could not find or load main class while executing jar file 错误:在执行 .jar 文件时无法找到或加载主类 - Error: Could not find or load main class while executing a .jar file 错误:解析XML文件时找不到或加载主类 - Error: Could not find or load main class while parsing an XML file 错误:运行.jar文件时无法找到或加载主类 - Error: Could not find or load main class while running .jar file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM