Categories

Debugging any Java Application

As long as you’re using a java application (ie an application calling your JVM), you can enable the debug mode with these parameters :

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

So for example, if you want to debug an ant launch (launched via « ant -f myBuild.xml » for example), you simply have to set ANT_OPTS; on windows :

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

Another example, with JBoss :

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

and then you can debug your launch with Eclipse, for example, creating a new debug configuration (remote java application on port 8787) !
Option : you can choose whether or not the application should wait for your debugger setting suspend to y or n.

1 comment to Debugging any Java Application

  • Update ! Make sure you use the same version of the JVM on both sides !(eclipse and the remote application launched in debug mode); for example if your application is started with a 64 bit JVM, your eclipse must use a 64 bits JVM also !

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">