Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDB does not work on OS X 10.11

Tags:

java

jdb

My Java version is 1.8.0_6. The JDB on my laptop can be started with a .class file, say MyClass.class. But after I type

run

conmmand, JDB first gives me a prompt "run MyClass", then it is stuck for a while. After that, it throws out the following error information,

VM start exception: VM initialization failed for: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/bin/java -Xdebug -Xrunjdwp:transport=dt_socket,address=promote.cache-dns.local:58261,suspend=y DebugMe

ERROR: transport error 202: connect failed: Operation timed out 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)

Fatal error: Target VM failed to initialize.

I have been compiling and running Java programs with "javac" and "java" properly in recent days. But I never used jdb before. Could anybody help me with this? Thanks in advance.

like image 254
Jay Avatar asked Nov 15 '15 15:11

Jay


1 Answers

I had the same issue, it is likely that

your host name promote.cache-dns.local actually resolves to your external IP, but your firewall blocks it.

Quick fix for me was adding my hostname to /etc/hosts as 127.0.0.1 my-host-name

like image 111
Stefan Penner Avatar answered Sep 22 '22 17:09

Stefan Penner