在Snow Leopard上运行Java 6。无法在Mac OS X上通过jinfo启用DTrace探针
你应该能够turn on ExtendedDTraceProbes on a running Java process with the jinfo utility。即使在我的命令提示符下金佛山约会谈有关启用通用标志:
Usage:
jinfo [option] <pid>
(to connect to running process)
...
where <option> is one of:
-flag [+|-]<name> to enable or disable the named VM flag
而且据我所知DTrace的标志没有任何特殊的价值,这只是他们的存在或不存在的事项。
但是,当我尝试这样做时,我得到两个错误之一,具体取决于我是否用sudo作为前言。
假设:
JPS
1234 StayRunning
...
相同的用户StayRunning过程:
金佛山-flag + ExtendedDTraceProbes 1234
Exception in thread "main" java.io.IOException: Command failed in target VM
at sun.tools.attach.MacosxVirtualMachine.execute(MacosxVirtualMachine.java:200)
at sun.tools.attach.HotSpotVirtualMachine.executeCommand(HotSpotVirtualMachine.java:195)
at sun.tools.attach.HotSpotVirtualMachine.setFlag(HotSpotVirtualMachine.java:172)
at sun.tools.jinfo.JInfo.flag(JInfo.java:111)
at sun.tools.jinfo.JInfo.main(JInfo.java:58)
Trying,作为根:
须藤金佛山标志+扩展dedDTraceProbes 1234
Password: (which I enter)
1234: Unable to open socket file: target process not responding or HotSpot VM not loaded
的错误是在第二行上,当然该过程仍在运行。
奇怪的是,this page doesn't show the "+" option for OS X,但我自己的机器打印出使用信息。
这是我的简单代码。它与Eclipse类似的失败。
StayRunning.java
class StayRunning {
public static void main(String [] args) throws Exception {
long counter = 0L;
while(true) {
Thread.sleep(1000);
counter++;
System.out.println("tick "+counter);
}
}
}
这个问题得到了风滚草。:-(许多开发者使用Mac,所以我很惊讶的是他人看到这个?或者你们都有同样的问题,还在等待答案?嗯......好吧,如果你有这个问题,至少要评论!痛苦爱公司你知道。 – 2011-02-27 00:05:08