com/sun/tools/attach/VirtualMachine in OpenJDK 7 & 8

Henri Gomez henri.gomez at gmail.com
Fri Apr 13 07:05:06 PDT 2012


It works !

Is it an expected behaviour for OpenJDK 7/8 or only OSX version ?

2012/4/13 Daniel D. Daugherty <daniel.daugherty at oracle.com>:
> Henri,
>
> Try adding $JAVA_HOME/lib/tools.jar to your classpath...
>
> Dan
>
>
>
> On 4/13/12 7:34 AM, Henri Gomez wrote:
>>
>> I tried to use CRASH (http://vietj.github.com/crash/), a nice JVM
>> console, with OpenJDK 7 (and 8) on OSX using community build
>> (http://code.google.com/p/openjdk-osx-build/)/
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> com/sun/tools/attach/VirtualMachine
>>        at org.crsh.standalone.CRaSH.main(CRaSH.java:92)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>        at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>        at java.lang.reflect.Method.invoke(Method.java:601)
>>        at
>> org.crsh.cmdline.matcher.MethodMatch.doInvoke(MethodMatch.java:153)
>>        at
>> org.crsh.cmdline.matcher.CommandMatch.invoke(CommandMatch.java:76)
>>        at org.crsh.standalone.CRaSH.main(CRaSH.java:237)
>> Caused by: java.lang.ClassNotFoundException:
>> com.sun.tools.attach.VirtualMachine
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>        ... 8 more
>>
>> Source code is here :
>>
>>
>> https://github.com/vietj/crash/blob/master/shell/core/src/main/java/org/crsh/standalone/CRaSH.java
>>
>> Exception occurs in :
>>
>> VirtualMachine vm = VirtualMachine.attach("" + pid);
>> vm.loadAgent(f.getCanonicalPath(), options);
>>
>> Some search in Google reported a possible missing lib attach
>> (https://bbs.archlinux.org/viewtopic.php?id=131700)
>>
>> But libattach is bundled in JVM :
>>
>>
>> /Library/Java/JavaVirtualMachines/1.7.0u4.jdk/Contents/Home/jre/lib/libattach.dylib
>>
>> Is it a known issue for OpenJDK 7 or is it specific to OSX implementation
>> ?
>>
>> Cheers



More information about the jdk7u-dev mailing list