Debugging JNLP started application

我怕爱的太早我们不能终老 提交于 2019-11-28 21:54:06

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:

  1. 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).
  2. Set a breakpoint inside your windowClosing method.
  3. Try to close your application - Eclipse should break the execution on your breakpoint
  4. 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.

There are times when even the console doesn't show anything, for example when there is a problem with the TLS/SSL handshake (i.e. a close_notify or handshake_failure). In these cases you need to do the following:

  1. Enable the Java logs and tracing in the Java Control Panel > Advanced.

  2. Enable parameters for debugging Java & launching the JNLP, there are two ways you can do it:

    2.a. Download the JNLP file and execute it from command line (the SET command is not required in this particular case).

    set JAVA_TOOL_OPTIONS=-Djavax.net.debug=all
    javaws -wait jnlp.jnlp
    

    2.b. Add arguments (i.e. -Djavax.net.debug=all) for the JVM in the Java Control Panel > Java > View (this is not required in this particular), and launch the JNLP file from browser:

  3. The logs and traces are located in the log directory from the Java Deployment Home from where I paste these locations:

    a. Windows XP: %HOME%\Application Data\Sun\Java\Deployment

    b. Windows 7/Vista: %APPDATA%\..\LocalLow\Sun\Java\Deployment

    c. Linux/Solaris: %HOME%/.java/deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!