java - Debugging JNLP started application -


i created java desktop-application (using swing) , trying make work starting net using jnlp. application works fine when start terminal, launch jnlp, not close. have manually kill process every time.

i read there might problem if jframe uses dispose_on_close default close-operation, doesn't. uses do_nothing_on_close (implicitly). also, i'm explicitly calling system.exit(0) after releasing objects:

f = new jframe("pacman"); f.addwindowlistener(new windowadapter() {     @override     public void windowclosing(windowevent e) {         // terminate game-loop:         gameloop.instance.stoploop();         // close application:         system.exit(0);     } }); 

i guess there might exception thrown when close application, can't find way console-output (e.g. stack-trace) of running application started jnlp. here's tried:

  • start javaws debugging parameters , connect jconsole (works can't find exception- or console-ouput).
  • start javaws debugging parameters , attach intellij debugger (also works not give me output)

so, how can start application jnlp , output (written default out- , error-streams), if normal desktop application?

solution #1 - enable java console, , exceptions.

you can via java control panel. switch advanced tab, , in java console make sure show console selected.

then, run application , monitor console exceptions. fix exception.

solution #2 - debug running application (properly).

start web start app (for java 1.6 , newer):

javaws -verbose -j-xdebug -j-xnoagent -j-xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8123 http://myserver.com/path/to/myapp.jnlp 

if using earlier java versions (1.4.2, 1.5) set environment variable, this:

set javaws_vm_args="-xdebug -xnoagent -xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8123" 

and run app via:

javaws http://myserver.com/path/to/myapp.jnlp 

when app runs:

  1. attach debugger (eclipse - use run => debug configurations => remote java application, , in connection properties panel enter port passed in parameters javaws (in case: 8123).
  2. set breakpoint inside windowclosing method.
  3. try close application - eclipse should break execution on breakpoint
  4. step into gameloop.instance.stoploop() method see where/when hangs.

don't expect see solutions in console, step through code debugger - if application hangs, show where.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -