|
The experience of debugging Java applets in Java Plug-in has not been too easy in the past, partly because the applets relies lots of services and facilities from the Java 2 Runtime Environment, Java Plug-in, and the browser itself. If the applet doesn't work, the developer normally will need to spend certain amount of time to figure out what exactly the problem is, or take a wild guess. The purpose of this document is to bridge this debugging gap. We will provide various techniques and suggestions for developing applets in Java Plug-in. We will also outlines some of the most common mistakes/problems in applet development, so you don't have to fall into the same trap again. How to debug applets in Java Plug-in In order to debug your applets you must have appropriate version of
Java 2 Development Kit, Standard Edition (JDK) installed on your machine. Also make sure to compile your
applet's .java files with -g option in javac. Steps to debug the applet are as follows
When debugging applets in Java Plug-in, please make sure NO more than one instance of the browser are debugged using the same connection address at the same time. Otherwise, it will result in conflict because the Java Runtime running inside different instance of the browsers will try to gain exclusive access to the same connection address. Therefore, 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 run in the desktop process in the lifetime of the user session. You may also use other Java 2 debuggers instead of jdb. For example, you may use Inprise's JBuilder or Symantac's VisualCafe to debug applets in Java Plug-in. To debug applets using 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. A different Java Runtime Parameters may also be required to be used 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 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 it could be enabled from the Java Plug-in Control Panel. If the console is enabled, you should see the console window popup 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, and it 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 is for controlling whether Java Plug-in should print out its trace messages during execution. This is invaluable to applets developers to determine what exactly Java Plug-in is doing under the hood. The possible values are either 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 is for controlling whether the security system of the Java 2 Runtime Environment should print out its trace messages during execution. This is invaluable to applet developers when security exception is thrown in their applets or when their signed applets 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 leveraging various features in Java Plug-in. We also documented some of the most frequently asked questions in our FAQ as well. Please make sure you spend sometime to read and understand these documents during applet development, and it may save you hundreds of hours in debugging. Isolating bugsAlthough Java Plug-in provides 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 or the Java 2 Runtime itself. It is extremely important to determine where the bugs belong, because it will speed up/slow down the bug evaluation and bug fix process. In some other cases, the bug may be an user error in the applet code. Here are some suggestions to isolate the bug:
Submitting Bug ReportTo submit bug report, you may go to the Java Development Connection's BugParade. Before submitting a bug, you should search the BugParade to determine if the bug has been reported previously and fixed. In some cases, workaround may also have been suggested. If the bug is not reported previously, you may submit a new bug report to the Java Plug-in team. In the bug report, please make sure the following information are included:
Once the Java Plug-in team received the bug report with all the necessary information, it will be evaluated properly. Submitting Feature RequestTo submit feature request, you may go through Java Development Connection. In the feature request, please make sure the following information are included:
Once the Java Plug-in team received the feature request, it will be evaluated properly. Java Plug-in Feedback AliasThe purpose of the Java Plug-in Feedback alias java-plugin-feedback@sun.com is for customers to provide feedback on various product features and the product itself in general, so the Java Plug-in team will be able to improve the product to fit the customers' needs. However, this alias is not intended for bug report submission. To submit bug report, please follow the instruction described earlier in this document. | |||||||||||||||||||||||||||||||
[ This page was updated: 02-Dec-99 ] | ||
Community Discussion | Industry News | Solutions Marketplace | Case Studies | ||
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World | ||
| ||
|