Git Product home page Git Product logo

Comments (12)

aragozin avatar aragozin commented on July 22, 2024

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.

from jvm-tools.

941112341 avatar 941112341 commented on July 22, 2024

thans for your reply.Maybe it's about version.When i upgrade jdk8 to 9,it work well.

from jvm-tools.

aragozin avatar aragozin commented on July 22, 2024

jdk9 doesn't include tools.jar, it includes required classes as part of standard runtime

from jvm-tools.

zhonghuasheng avatar zhonghuasheng commented on July 22, 2024
$ 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.

from jvm-tools.

aragozin avatar aragozin commented on July 22, 2024

Try where java (which on Linux). tools.jar is searched relative to java binary (not JAVA_HOME variable).

from jvm-tools.

zhonghuasheng avatar zhonghuasheng commented on July 22, 2024

Try where java (which on Linux). tools.jar is searched relative to java 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.

from jvm-tools.

aragozin avatar aragozin commented on July 22, 2024

Your PATH variable should point JDK/bin not JRE/bin

from jvm-tools.

zhonghuasheng avatar zhonghuasheng commented on July 22, 2024
  • My JAVA_HOME path
    image
  • Checked JAVA
    image
  • Execution result
    image

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.

from jvm-tools.

aragozin avatar aragozin commented on July 22, 2024

please execute where java

from jvm-tools.

zhonghuasheng avatar zhonghuasheng commented on July 22, 2024

image

from jvm-tools.

zhonghuasheng avatar zhonghuasheng commented on July 22, 2024

I see it point to jdk1.7, not 1.8

from jvm-tools.

aragozin avatar aragozin commented on July 22, 2024

where java should report java.exe from JDK on first line (ideally it should report single line)

from jvm-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.