FULL PRODUCT VERSION :
java version "1.6.0_01-ea"
Java(TM) SE Runtime Environment (build 1.6.0_01-ea-b03)
Java HotSpot(TM) Client VM (build 1.6.0_01-ea-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP Home Edition 2002,SP2
A DESCRIPTION OF THE PROBLEM :
I use the attach api which is in the tools.jar,it always throws the exception of java.lang.UnsatisfiedLinkError: no attach in java.library.path.I test the attach api on the linux platform and it works well. So i think it's the jdk6 for windows has bugs.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a Monitor.java file as below:
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
public class Monitor {
public static void main(String[] args) throws Exception {
for (VirtualMachineDescriptor desc : VirtualMachine.list()) {
System.out.println(desc.displayName());
}
}
}
compile it with the command :
javac -classpath %JAVA_HOME%\lib\tools.jar Monitor.java
then run the application:
java -cp %JAVA_HOME%\lib\tools.jar;. Monitor
it can't run normally and it throws the exception as the following:
java.lang.UnsatisfiedLinkError: no attach in java.library.path
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It will show the running the VirtualMachine.
ACTUAL -
It throws an exception in the runtime.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
can't find these files:
\jre\lib\sunrsasign.jar
\jre\classes,
ClassNotFoundException:
sun/tools/attach/WindowsAttachProvider sun.tools.attach.WindowsAttachProvider sun/tools/attach/HotSpotAttachProvider sun.tools.attach.HotSpotAttachProvider sun/tools/attach/WindowsVirtualMachine sun.tools.attach.WindowsVirtualMachine sun/tools/attach/HotSpotVirtualMachine sun.tools.attach.HotSpotVirtualMachine
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
public class Monitor {
public static void main(String[] args) throws Exception {
for (VirtualMachineDescriptor desc : VirtualMachine.list()) {
System.out.println(desc.displayName());
}
}
}
---------- END SOURCE ----------
java version "1.6.0_01-ea"
Java(TM) SE Runtime Environment (build 1.6.0_01-ea-b03)
Java HotSpot(TM) Client VM (build 1.6.0_01-ea-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP Home Edition 2002,SP2
A DESCRIPTION OF THE PROBLEM :
I use the attach api which is in the tools.jar,it always throws the exception of java.lang.UnsatisfiedLinkError: no attach in java.library.path.I test the attach api on the linux platform and it works well. So i think it's the jdk6 for windows has bugs.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a Monitor.java file as below:
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
public class Monitor {
public static void main(String[] args) throws Exception {
for (VirtualMachineDescriptor desc : VirtualMachine.list()) {
System.out.println(desc.displayName());
}
}
}
compile it with the command :
javac -classpath %JAVA_HOME%\lib\tools.jar Monitor.java
then run the application:
java -cp %JAVA_HOME%\lib\tools.jar;. Monitor
it can't run normally and it throws the exception as the following:
java.lang.UnsatisfiedLinkError: no attach in java.library.path
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It will show the running the VirtualMachine.
ACTUAL -
It throws an exception in the runtime.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
can't find these files:
\jre\lib\sunrsasign.jar
\jre\classes,
ClassNotFoundException:
sun/tools/attach/WindowsAttachProvider sun.tools.attach.WindowsAttachProvider sun/tools/attach/HotSpotAttachProvider sun.tools.attach.HotSpotAttachProvider sun/tools/attach/WindowsVirtualMachine sun.tools.attach.WindowsVirtualMachine sun/tools/attach/HotSpotVirtualMachine sun.tools.attach.HotSpotVirtualMachine
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
public class Monitor {
public static void main(String[] args) throws Exception {
for (VirtualMachineDescriptor desc : VirtualMachine.list()) {
System.out.println(desc.displayName());
}
}
}
---------- END SOURCE ----------