patric-r / jvmtop

Java monitoring for the command-line, profiler included
GNU General Public License v2.0
1.23k stars 253 forks source link

Issue with Java 11 (no tools.jar existent) #119

Open philipp-eliasch opened 5 years ago

philipp-eliasch commented 5 years ago

@patric-r, I'm seeing this error with openjdk: [user@server jvmtop-0.8.0]$ ./jvmtop.sh /usr/lib/jvm/java-11-openjdk-11.0.3.7-0.el7_6.x86_64 seems to be no JDK!

It has something to do with the tools.jar [user@server jvmtop-0.8.0]$ grep -3 seems jvmtop.sh TOOLSJAR="$JAVA_HOME/lib/tools.jar"

if [ ! -f "$TOOLSJAR" ] ; then echo "$JAVA_HOME seems to be no JDK!" >&2 exit 1 fi

tools.jar which seems to be a prerequisite for running jvmtop was removed with java 9, see https://www.reddit.com/r/javahelp/comments/765mwr/installed_jdk_9_and_my_toolsjar_is_missing/

[user@server jvm]$ find /usr/lib/jvm/* -type f -name tools.jar [user@server jvm]$

So it can't be used at least with OpenJDK or Amazon Corretto in Version 11. Any ideas?

patric-r commented 5 years ago

Thanks for the hint, I'll have a look as soon as I have more time again. Any suggestions how to solve this are welcome.

philipp-eliasch commented 5 years ago

No suggestion on how to solve, but found a good workaround.

[user@server ~]$ top -H -p 7809 # where 7809 is the pid of jvm

Java 11 shows thread names. Java 8 shows all thread names as "java" which is not really helpful. Tested with Oracle OpenJDK and Amazon Corretto OpenJDK. Source: https://backstage.forgerock.com/knowledge/kb/article/a39551500

andredasilvapinto commented 5 years ago

jvmtop is broken in other ways with regards to java >= 9. For example, it relies on management-agent.jar ( https://github.com/tellapart/jvmtop/blob/master/src/com/jvmtop/openjdk/tools/LocalVirtualMachine.java#L350-L367 ) which was removed here: https://www.oracle.com/technetwork/java/javase/9-removed-features-3745614.html#JDK-8043939

pditommaso commented 4 years ago

+1 for this. I think it would require to use the new module system and repackage it. Some info here https://stackoverflow.com/a/52645592

bor8 commented 4 years ago

I found a nice fork for Java 11 and created a small guide with a download: https://github.com/patric-r/jvmtop/issues/109#issuecomment-622044148