天天看點

mac版 eclipse 隻能run不能debug的解決方案

mac:macOS Sierra 10.12.2

eclipse:Version: Neon.1a Release (4.6.1)

debug時進度一直停在93%,然後逾時報錯:

mac版 eclipse 隻能run不能debug的解決方案

ERROR: transport error 202: gethostbyname: unknown host
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [debugInit.c:750]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
           

分析錯誤提示,是找不到主機host,google一下,在stackoverflow找到了解決方案,在hosts中加入

127.0.0.1 localhost
           

-hosts修改方法:

hosts不能直接在/etc中修改;

在Finder中,點選shift+command+G,輸入/etc,将hosts檔案拷貝到桌面,修改後再拷貝回去(需要輸入密碼)。

再次debug,正常!

mac版 eclipse 隻能run不能debug的解決方案
  • 參考:
http://stackoverflow.com/questions/29188789/eclipse-mac-os-x-debug-error-fatal-error-in-native-method-jdwp-no-transports

原文來自:

http://kekefund.com/2017/01/10/mac-eclipse-debug/

繼續閱讀