Solution #1 - Enable Java Console, and look for exceptions.
You can do it via Java Control Panel. Switch to Advanced tab, and in the Java Console make sure Show console is selected.
Then, run your application and monitor the console for exceptions. Fix the exception.
Solution #2 - Debug your running application (properly).
Start the Web Start app like this (for Java 1.6 and 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 the environment variable, like this:
set JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8123"
and run the app via:
javaws http://myserver.com/path/to/myapp.jnlp
When the app runs:
- Attach a debugger (Eclipse will do - use Run => Debug Configurations => Remote Java Application, and in Connection Properties panel enter the port passed in the parameters to
javaws
(in this case: 8123
).
- Set a breakpoint inside your
windowClosing
method.
- Try to close your application - Eclipse should break the execution on your breakpoint
- Step into the
GameLoop.INSTANCE.stopLoop()
method to see where/when it hangs.
Don't expect to see a solutions in the console, just step through the code with a debugger - if the application hangs, it will show you where.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…