Mac OS HSDB HotSpot Debugger can not attach to the process

女生的网名这么多〃 提交于 2020-01-06 05:15:29

问题


I want to use HSDB to debug my java code. I follow the steps blow:

  1. Debug my code in IntelliJ and stop at a breakpoint
  2. Start HSDB:

    java -cp ,:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar sun.jvm.hotspot.HSDB

  3. use jps to get the pid
  4. attach to the pid, but error occurs.

My java version:

java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

My os version:

  System Version: macOS 10.13.3 (17D102)
  Kernel Version: Darwin 17.4.0
  Boot Volume: 未命名
  Boot Mode: Normal
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 6 days 1:08

Can someone gives me some advices? Thanks in advance.


回答1:


I found that I need to use sudo

sudo java -cp ,:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar sun.jvm.hotspot.HSDB



来源:https://stackoverflow.com/questions/52093130/mac-os-hsdb-hotspot-debugger-can-not-attach-to-the-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!