score:38

Accepted answer

This is what we are adding to our JBoss command line while development:

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

Then we launch the eclipse remote debugging and connection to this port.


Update:

To run from jar (standalone) do the following

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8585,server=y,suspend=n -jar start.jar 

score:0

Using the JVM "agentlib" command-line parameter before "start.jar" did not work for me, but this does:

How to allow Eclipse to remotely debug #Jetty (#JPDA #agentlib:jdwp) on port 8000

You have to create a file, $JETTY_BASE/start.ini (do not change $JETTY_HOME/start.ini) and put the following two lines in it:

  • --exec
  • -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n

score:15

If you will use mvn jetty:run one day, you have to

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

appending -Xdebug ... doesn't works

score:18

For remote debugging you should use JPDA. There's a sort of tutorialish article about it available here.

In short, start your JVM with the argument:

-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n

and you are able to connect to the underlying JVM listening on port 8000 via the standard Eclipse debugger.


Related Query

More Query from same tag