Debugging a Java Application with a Startup Bug

How can you remotely debug a JVM with an initialization erorr in your application?

The normal debug JVM parameters require you to attach really quickly:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -Xmx512m

By making suspend=y,timeout=5000 the JVM waits 5 seconds for an attach.
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=5005,suspend=y,timeout=5000 -Xmx512m

This made it easier to get to my IDE to attach the debugger and still have the initialization code breakpoints get triggered.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s