Apr 22
Debugging a Java Web Start application from Eclipse
Posted by James Netherton | Wednesday 22 April 2009 17:52 PM | In Java
I just spent some time debugging a weird problem that was only occurring when an application was launched via Java Web Start. Something I found useful was being able to attach the Eclipse Java debugger to the application process. Here’s how to set this up.
From the command line execute (In windows use set instead of export):
export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
In Eclipse, configure a new debug configuration by choosing menu options Run -> Debug Configurations. Find the ‘Remote Java Application’ section, right click and choose ‘New’.
Change the port number to whatever you specified when setting up the JAVAWS_VM_ARGS environment variable. Click the apply button and close the window.
Now start your application:
javaws http://hostname:port/yourjnlpfile.jnlp
You can now attach the Eclipse debugger to the process by running the debug configuration you just set up. Set some breakpoints in your code and you should find the application suspends at the relevant points where you can debug the application as per normal.
1 Comment
[Post comment]
1
Posted by Sergejzr | Tuesday 28 July 13:12 PM
Thank you for this short and powerfull tutorial!