Trouble shooting and debugging Java[TM] Web Start Applications.


1.0) Tracing and getting additional trace output.

1.1) Using version 1.5.0 or 1.6.0.

Use the Java[TM] Control Panel to turn on console and tracing to a file. By default the file will be put in log directory under $deployment.user.home.  (for per-platform definition of $deployment.user.home see the Deployment Guide )

Turn on additional tracing messages by adding the following property to the deployment.properties file:
deployment.trace.level=all.

You can also use specific options delimited by "|", all is the same as:
deployment.trace.level=basic|cache|net|temp|security|ext|liveconnect.

The last 2 in the above may only apply to Java[TM] Plug-in and have no effect on Java Web Start apps.

1.2) Using version 1.4.2.

Use the Application Managers preferences dialog to turn on the console and to enable logging to a file.  (Here "logging" is the same as "tracing" in later versions)

Turn on additional tracing messages by creating a file named ".javaws" in your home directory containing some of the following lines:
TraceSecurity=true
TraceStartup=true
TraceSplashScreen=true
TraceProxies=true
TraceCache=true
TraceMuffins=true
TraceDiskCache=true
TraceAppletViewer=true
TraceJRESearch=true
TraceExtensions=true
TraceHTMLEntryParsing=true
TracePlayerImageLoading=true
TraceCacheEntryManager=true
TraceLocalAppInstall=true
TraceDownload=true
TraceJarDiff=true
TraceIgnoredExceptions=true
TraceAutoUpdater=true
TraceXMLParsing=true

1.3) TraceOutput from native code (before java is invoked).

In all versions you can use the environmental variable JAVAWS_TRACE_NATIVE to output additional information from the native startup code.  In most cases this will only output the full command used to launch java.

2.0) Special tip for all debugging.

Javaws can be launched with either a file arg, or a url arg.  When used normally, such as launching from a browser, a shortcut, or from the Application Manager or Cache Viewer, it is launched using a file as an arg.

In all versions, it is possible to "double launch".  That is, the native javaws process will launch the java process which will then launch another java process to run the application.  Using the above tracing you can see when this is happening.  In almost all cases (other than some obscure bugs in 1.4.2) this can be avoided by running javaws with a file as an arg.  If you runL "javaws http://www.xxx.com/.../xyz.jnlp", the native code will not see the jnlp file before launching java, so if there are any vm-args, stack size requirements, or you are not using the latest jre on the system, it will double launch.

So when debugging, it is always best to download the jnlp file, and then launch javaws using that file as the arg.

3.0) Debugging.

The NetBeans[TM] IDE version 5.0 contains a Java Web Start plugin.  For information on how to debug using the builtin support in NetBeans see the netbeans plugin documentation.

It should not be necessary to launch java directly, using the args obtained by using the JAVAWS_TRACE_NATIVE environment variable above, unless you need get the stacktrace of a deadlocked java by using "kill -3 <process>" or <ctrl-break> on Windows.



3.1) Debugging using Java Web Start 6.0.

Version 6.0 allows the command line -J option (just like javac) to allow you to pass arbitrary arguments to the java vm, so you will want to run something like (depending on debugger used):

javaws -verbose -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8200 myapp.jnlp

The same thing can be done using the environment variable used in 1.4.2 and 1.5.0:

setenv JAVAWS_VM_ARGS "-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8200"
javaws myapp.jnlp



3.2) Debugging using Java Web Start 1.5.0 or 1.4.2


Set the environment variable JAVAWS_VM_ARGS to the values needed by your debugger, and then run your app.

setenv JAVAWS_VM_ARGS "-Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=8200"
javaws myapp.jnlp