{"id":947,"date":"2011-01-07T14:49:43","date_gmt":"2011-01-07T13:49:43","guid":{"rendered":"http:\/\/www.thomaskeller.biz\/blog\/?p=947"},"modified":"2011-01-07T14:52:51","modified_gmt":"2011-01-07T13:52:51","slug":"debugging-java-webstart-applications-with-eclipse","status":"publish","type":"post","link":"https:\/\/www.thomaskeller.biz\/blog\/2011\/01\/07\/debugging-java-webstart-applications-with-eclipse\/","title":{"rendered":"Debugging Java WebStart applications with Eclipse"},"content":{"rendered":"<p>The last couple of days I went through a little nightmare: I needed to debug a Java application which showed some weird behaviour only when loaded via WebStart, but not when executed within Eclipse.<\/p>\n<p>[Multiple](http:\/\/www.jacoozi.com\/index.php?option=com_content&#038;task=view&#038;id=119&#038;Itemid=134) [internet](http:\/\/javaswamy.blogspot.com\/2008\/10\/debugging-jws-with-eclipse.html) [resources](http:\/\/www.ibm.com\/developerworks\/java\/library\/os-eclipse-javadebug\/index.html) told me to use the `JAVAWS_VM_ARGS` environment variable to tell the Java VM to either create a debug socket itself or connect to some socket started from Eclipse and then simply set a breakpoint there and wait for the meal. But nothing worked out for me, until I found two very important issues nobody wrote about so far:<\/p>\n<p> * Under Java 6 `JAVAWS_VM_ARGS` seems to be completely ignored by `javaws`, on Linux and on Windows. The way to go was to use separate `-J` options in the call to `javaws` &#8211; and given a running Eclipse debug server you finally saw the threads of your running application.<br \/>\n * Wait, were these threads really belonging to _your_ running application? This was the second issue. Apparently `javaws` directly forks away as soon as it started and runs your application in a separate VM, which _of course_ did not get the original debug options passed. Again, some internet resources said it would be enough to load the jnlp file from the net and start locally, but actually this did not work out. The magic option to apply to `javaws` here was `-Xnofork` and finally, on the next run I saw my application&#8217;s threads in Eclipse and my breakpoints magically worked as expected.<\/p>\n<p>Here is the complete command line example again (given a running Eclipse debug server on port 8000):<\/p>\n<p>    javaws -Xnofork -J-Xdebug -J-Xnoagent \\<br \/>\n        -J-Xrunjdwp:transport=dt_socket,server=n,address=8000 \\<br \/>\n        path\/to\/app.jnlp<\/p>\n<p>Hope that helps someone \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last couple of days I went through a little nightmare: I needed to debug a Java application which showed some weird behaviour only when loaded via WebStart, but not when executed within Eclipse. [Multiple](http:\/\/www.jacoozi.com\/index.php?option=com_content&#038;task=view&#038;id=119&#038;Itemid=134) [internet](http:\/\/javaswamy.blogspot.com\/2008\/10\/debugging-jws-with-eclipse.html) [resources](http:\/\/www.ibm.com\/developerworks\/java\/library\/os-eclipse-javadebug\/index.html) told me to use the `JAVAWS_VM_ARGS` environment variable to tell the Java VM to either create a debug &hellip; <a href=\"https:\/\/www.thomaskeller.biz\/blog\/2011\/01\/07\/debugging-java-webstart-applications-with-eclipse\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Debugging Java WebStart applications with Eclipse<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,11],"tags":[],"class_list":["post-947","post","type-post","status-publish","format-standard","hentry","category-coding","category-work"],"_links":{"self":[{"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/posts\/947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/comments?post=947"}],"version-history":[{"count":5,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/posts\/947\/revisions"}],"predecessor-version":[{"id":951,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/posts\/947\/revisions\/951"}],"wp:attachment":[{"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/media?parent=947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/categories?post=947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thomaskeller.biz\/blog\/wp-json\/wp\/v2\/tags?post=947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}