14-06-2005, 08:11
|
|
|
|
חבר מתאריך: 07.09.02
הודעות: 17,302
|
|
How to Debug Applets in Java Plug-in
How to Debug Applets in Java Plug-in
In order to debug applets, you must have the appropriate version of the Java 2 SDK, Standard Edition, installed on your machine. Also make sure to compile your .java files with -g option with javac. To begin debugging your applet: - Start the Java Plug-in Control Panel. On the Advancedtab, specify the following parameters in the Java Runtime Parameters: -Djava.compiler=NONE
-Xnoagent
-Xdebug
-Xrunjdwp:transport=dt_shmem,address=
<connection-address>,server=y,suspend=n
The <connection-address> could be any string which is used by the java debugger later to connect to the JVM. For example,
-Djava.compiler=NONE
-Xnoagent
-Xdebug
-Xrunjdwp:transport=dt_shmem,address=2502,server=y, suspend=n See JPDA Connection and Invocation for the details on the possible runtime parameters for debugging.
- On the Advanced tab in the Java Plug-in Control Panel, select "JDK <version> in <jdk-path>" for the Java Runtime Environment, where <version> is the Java Plug-in version and <jdk-path> is the path to the Java 2 SDK installation. For example, "JDK1.4 in C:\jdk1.4" .
- Start Internet Explorer or Netscape Navigator and load the page which contains the applet to be debugged. Make sure the applet code has been compiled with -g option with javac.
- Run the command jdb -attach <connection address> in a DOS command prompt. <connection address> is the name mentioned in the step 1. For example, if <connection address> is 2502, you will run the command as jdb -attach 2502
To learn more about the Java Debugger (jdb), see The Java Debugger. - Once the jdb has attached to the VM, you can set up breakpoints in the applet.
- When the applet in the browser reaches the breakpoint, it will stop executing, and you will see the debugger waiting for your input to continue debugging.
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 a conflict, since 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, run either Internet Explorer or Netscape Navigator with Java Plug-in—but not both at the same time.
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, consult your Java 2 debugger or IDE manuals.
http://java.sun.com/j2se/1.4.2/docs...e/debugger.html
_____________________________________
חתימתכם הוסרה כיוון שלא עמדה בחוקי האתר. לפרטים נוספים לחצו כאן.
|