Closed 941112341 closed 5 years ago
sjk is looking for file lib/tools.jar
relative to your JDK directory. tools.jar
is required to do all JVM discovery and attachment magic.
thans for your reply.Maybe it's about version.When i upgrade jdk8 to 9,it work well.
jdk9 doesn't include tools.jar, it includes required classes as part of standard runtime
$ java -jar sjk-0.12-SNAPSHOT.jar ttop -p 6344 -n 20 -o CPU
Java home points to C:\Program Files\Java\jre1.8.0_181 make sure it is not a JRE path
Failed to add tools.jar to classpath
java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.gridkit.lab.jvm.attach.AttachAPI.<clinit>(AttachAPI.java:45)
at org.gridkit.lab.jvm.attach.AttachManager.<clinit>(AttachManager.java:73)
at org.gridkit.jvmtool.JmxConnectionInfo.getMServer(JmxConnectionInfo.java:78)
at org.gridkit.jvmtool.cmd.ThreadTopCmd$TTop.run(ThreadTopCmd.java:92)
at org.gridkit.jvmtool.cli.CommandLauncher.start(CommandLauncher.java:133)
at org.gridkit.jvmtool.SJK.main(SJK.java:11)
java.lang.NoClassDefFoundError: com/sun/tools/attach/VirtualMachine
at org.gridkit.lab.jvm.attach.AttachManager$AttachManagerInt.getVmList(AttachManager.java:166)
at org.gridkit.lab.jvm.attach.AttachManager$AttachManagerInt.getProcesssName(AttachManager.java:155)
at org.gridkit.lab.jvm.attach.AttachManager$AttachManagerInt.internalGetDetails(AttachManager.java:150)
at org.gridkit.lab.jvm.attach.AttachManager.getDetails(AttachManager.java:95)
at org.gridkit.jvmtool.JmxConnectionInfo.getMServer(JmxConnectionInfo.java:78)
at org.gridkit.jvmtool.cmd.ThreadTopCmd$TTop.run(ThreadTopCmd.java:92)
at org.gridkit.jvmtool.cli.CommandLauncher.start(CommandLauncher.java:133)
at org.gridkit.jvmtool.SJK.main(SJK.java:11)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
I am sure I had correct set the JAVA home, and the path is C:\Program Files\Java\jdk1.8.0_181
, how can I get this error message? Please help.
Try where java
(which
on Linux). tools.jar
is searched relative to java
binary (not JAVA_HOME variable).
Try
where java
(which
on Linux).tools.jar
is searched relative tojava
binary (not JAVA_HOME variable I can successful run above cmd 'java -jar sjk-0.12-SNAPSHOT.jar ttop -p 6344 -n 20 -o CPU' in a Linux server, while failed in Windows server(using git-cmd to execute the cmd). And I am happy pass to install the JDK1.8, not sure what happened.
Your PATH variable should point JDK/bin not JRE/bin
I am also confuse why it print my Java home to a JRE path? Not make sense.
BTW, the guy @941112341 changed to JAVA9 to avoid this.
please execute where java
I see it point to jdk1.7, not 1.8
where java
should report java.exe from JDK on first line (ideally it should report single line)
Java home points to D:\fuck\jdk1.8 make sure it is not a JRE path Failed to add tools.jar to classpath java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at org.gridkit.lab.jvm.attach.AttachAPI.(AttachAPI.java:45)
at org.gridkit.lab.jvm.attach.AttachManager.(AttachManager.java:73)
at org.gridkit.jvmtool.cmd.ProcListCmd$JPS.run(ProcListCmd.java:74)
at org.gridkit.jvmtool.cli.CommandLauncher.start(Comman
.... but i can't undertand why?