Debugging Java applets in Java Plug-in has not been simple in the past, partly because the applets use many services and facilities from the Java 2 Runtime Environment, Java Plug-in, and the browser itself. If the applet does not work, the developer needs to spend time diagnosing the problem. The purpose of this document is to simplify the debugging process. We will provide techniques and suggestions for developing applets in Java Plug-in and outline some of the most common mistakes in applet development. How to debug applets in Java Plug-inIn order to debug applets, you must have appropriate version of the Java 2 SDK, Standard Edition installed on your machine. Also make sure to compile your .java files with -g option in javac. To begin debugging your applet:
When debugging applets in Java Plug-in, make sure that only one instance of the browser is being used for debugging using the same connection address at the same time. Otherwise, it will result in conflict because the Java Runtime for each instance of the browser will try to gain exclusive access to the connection address. To debug applets in both Internet Explorer and Netscape Navigator, you should make sure either Internet Explorer or Netscape Navigator is running with Java Plug-in at any given time, but not both. Debugging applets in Java Plug-in with Active Desktop is discouraged because an instance of Internet Explorer will always be running in the desktop process during the lifetime of the user session. You can use other Java 2 debuggers, like Inprise's JBuilder or Symantac's VisualCafe, instead of jdb. To use these debuggers, you will need to change the project option in these IDEs to attach Java Plug-in in the browser process on the same machine or remote machine. Different Java Runtime Parameters may also be required in the Java Plug-in Control Panel. For more information, please consult your Java 2 debugger or IDE manuals. Java Plug-in ConsoleOne of the most powerful tools in Java Plug-in is the Java Plug-in Console. It is a simple console window for redirecting all the System.out and System.err messages. By default, this console window is disabled, and can be enabled from the Java Plug-in Control Panel. If the console is enabled, you will see the console window appear when Java Plug-in is used in the browser. Java Plug-in Trace FileSimilar to the Java Plug-in Console, this is a file that records all the System.out and System.err messages. By default, this trace file is disabled, but is enabled automatically when Java Plug-in Console is enabled. The trace file is normally located in the user.dir, and the file is called plugin.trace. For example, in Windows NT, this file is located in C:\WINNT\Profiles\<username>\plugin.trace. javaplugin.trace propertyThis property controls whether Java Plug-in prints its trace messages during execution. This is useful to applet developers to determine what is occuring within Java Plug-in. The possible values are true or false. By default, this property is set to false. To enable this property, -Djavaplugin.trace=true should be put in the Runtime Parameters in the Java Plug-in Control Panel. java.security.debug propertyThis property controls whether the security system of the Java 2 Runtime Environment prints its trace messages during execution. This is usful to applet developers when a security exception is thrown in their applets or when their signed applet is not working. The following options are supported:
The following options can be used with access:
For example, to print all checkPermission results and dump all domains in context, -Djava.security.debug=access:stack will be specified in the Runtime Parameters in the Java Plug-in Control Panel. Online documentationJava Plug-in provides a rich set of documentation on our web site to help developers use various features in Java Plug-in. We also document some of the most frequently asked questions in our FAQ. Make sure you read and understand these documents before applet development, as it may save you hundreds of hours in debugging. Isolating bugsAlthough Java Plug-in provides the Java 2 Runtime Environment within Internet Explorer and Netscape Navigator, most of the facilities are provided by the Java 2 Runtime itself, rather than by Java Plug-in. Therefore, if a problem occurs in Java Plug-in, it may be either a problem in Java Plug-in, the Java 2 Runtime itself or a user error. It is extremely important to determine where the bugs originates, because it will affect the speed of the bug evaluation and bug fix process. Here are some suggestions for isolating the bug:
Submitting Bug ReportsTo submit a bug report, go to the Java Development Connection's BugParade. Before submitting a bug, search the BugParade to determine if the bug has already been reported and fixed. In some cases, a workaround may also have been suggested. If the bug is not already reported, submit a new bug report to the Java Plug-in team. In the bug report, include the following information:
Submitting Feature RequestsTo submit a feature request, you may go through the Java Development Connection. In the feature request, please make sure the following information is included:
Java Plug-in Feedback AliasThe purpose of the Java Plug-in Feedback alias http://java.sun.com/docs/forms/plugin-sendusmail.html is for customers to provide feedback on product features and the product in general. This alias is not intended for bug report submission. To submit a bug report, please follow the instructions earlier in this document. | ||||||
|
| ||||||||||||