简体   繁体   中英

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

I am using 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

java -version

O/P: java version "1.7.0_181"

while checking for jps I am getting like this,

jps    

O/P: Error: could not find libjava.so Error: could not find Java SE Runtime Environment.

My bashrc file be like,

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. Any help would be much appreciated.

Thanks in advance!!

I found java-related processes are sometimes quirky when it comes to libraries.

First identify the path for libjava.so and confirm the lib and executable are the same, one of 32- or 64-bit:

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

Next, for any process like jps as an example, run this:

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. For normal processes, setting LD_LIBRARY_PATH usually works, but java stuff is too often quirky. Try experimenting with cmd-lines or a script, eg:

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

(replace /usr/local/lib64 with the leading path to 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; as shown, the shell sets KEY=val only for the cmd-line.

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. 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.

Sometimes quick answers can be found with strace, made easier when limiting the output, eg:

strace -f -e execve,open jps

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