0

I have a Java (Vert.x) application on my machine that I am trying to attach Eclipse to for debugging.

I usually start the Java application in my console like so:

java -jar build/libs/my-app.jar

Upon reading about debugging, I am attempting to start the app as follows:

java -jar build/libs/my-app.jar -Xdebug -Xrunjdwp:transort:transport=dt_socket,address=8001,server=y,suspend=n

The app seems to start up in the console fine when I run this.

I then go into Eclipse, and try to connect to the app via debugging via Run -> Debug Configurations. This is what my debug configuration looks like:

my-app debugging

When I click debug, I get an error box that pops up and says that the connection is refused (I covered the name of my real app). See below:

enter image description here

What am I doing wrong? How can I get remote debugging to connect to my app with Eclipse?

3
  • Check whether java opened port using netstat, and make sure you have put correct hostname into Host input box Commented Apr 20, 2018 at 20:55
  • Also, check firewall is blocking the port. Commented Apr 20, 2018 at 20:58
  • also make sure your Eclipse Network Proxy Configuration is set to bypass the proxy for 127.0.0.1 and localhost. Commented Apr 20, 2018 at 21:18

1 Answer 1

3

According to my reading of this JDWP documentation, your -Xrunjdwp option is incorrect:

-Xrunjdwp:transort:transport=dt_socket,address=8001,server=y,suspend=n

should be

-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n

If your system has multiple IP addresses, there could be some confusion about which IPs the agent is listening for connections on. You could force a specific address; e.g.

-Xrunjdwp:transport=dt_socket,address=127.0.0.1:8001,server=y,suspend=n

and use the matching IP and port in the Eclipse debug connection parameters.


AND ... as Dave Thompson spotted ... all JVM options must be placed before the -jar argument. (Anything after the -jar name.jar will be treated as command line arguments for your application.)

Sign up to request clarification or add additional context in comments.

2 Comments

And it must be before the -jar jarfile option; anything after -jar jarfile or mainclassname is used as argument(s) to the Java application.
Good catch! Updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.