Remote Debugging an Applet in JBuilder 8

By: Christopher Moeller

Abstract: Steps to setup and launch remote debugging for applets in JBuidler 8

Remote Debugging an Applet in JBuilder 8


Creating a test project and applet (in JBuilder) for demonstrating remote debugging:

1. File | New Project | <fill in project name> | Finish

2. File | New | Web | Applet | <fill in applet name> | Finish

3. Wizards | Archive Builder... | Applet Zip | Finish.

4. Open the applet source in the Editor, but then choose the Design tab. In the UI Designer, drop a JButton and a JTextField on the applet.

5. Double click on the JButton in the Designer and add the following code to the jButton1_actionPerformed method:

jTextField1.setText("Button Clicked");

6. Now, place a breakpoint on the above line in the Editor.

7. Project | Rebuild Project

8. Next, find the <applet_name>.html located in the classes directory and copy it to the project_home directory (where the applet zip file is located).

9. Open the HTML file in a text editor and add the following line within the <applet> tag:

archive = "<archive_name>.zip"

10. After saving the HTML file, you should be able to load it using a web browser to see your applet run (verify before continuing).


Converting the standard HTML file generated for the applet to use the Java Plug-in (for the web browser):

1. Run "HtmlConverter.exe" found in .\JBuilder8\jdk14\bin.

2. Use the Browse... button to navigate to the location of the HTML file (that we modified above).

3. After verifing that the tool is set to create a backup (check the path), click on the Convert... button.

4. Click Done, and then close the "Java Plug-in HTML Converter."

5. Double-clicking the newly converted HTML file should still load the applet (verify before continuing).


Deploying the Applet to a web server (IIS) (Optional)

1. Copy the ZIP file and the HTML file and place them into the following directory, which is the default root for the IIS web server (Windows XP defaults shown below):


2. Once the files are located in this directory, you will be able to load your applet by navigating to the following URL (verify before continuing):



https://localhost:80/Applet1.html (if deployed to the same machine)


Configuring the Java Plug-in for remote debugging:

1. Close any open browser windows.

2. In Windows, choose Start | Settings | Control Panel | Java Plug-in.

3. Under the Basic tab, select the "Show console" option (for troubleshooting).

4. Under the Advanced tab, add the following line to the Java Runtime Parameters field:

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,address=3999,suspend=n

5. Under the Browser tab (if it exists), verify that the correct Internet browser is selected.

6. Click Apply, and then close the "Java (TM) Plug-in Control Panel."


Configuring the JBuilder project for remote debugging:

1. Back in JBuilder, choose: Run | Configurations... | New...

2. Fill in a Name (e.g. Remote Debug Applet), choose "None" for the build target, select "Applet" for the type, and then select the main class (for the applet).

3. Next, choose the Debug tab, select "Enable Remote Debugging", choose "Attach," fill in the host name field and click OK.

4. Note the new Run Configuration listed in the list box, and then close the Project Properties (click OK).


Initiating a Remote Debugging session:

1. First, open a browser and navigate to the URL for your applet. If you did not deploy the applet to IIS, instead just double-click on the converted HTML file.



https://localhost:80/Applet1.html (if deployed to the same machine)

2. Next, back in JBuilder, start the debugging session for your project by launching your (debug) configuration that you previously created. The debugger should start up and connect to the plug-in VM started with your browser.

3. Finally, click on the button in your applet within the loaded browser. This should cause the debugger to then stop at the breakpoint you set within the jButton1_actionPerformed method, indicating that the remote debugging session was successful.

Published on: 12/26/2002 12:00:00 AM

Server Response from: ETNASC01

Copyright© 1994 - 2013 Embarcadero Technologies, Inc. All rights reserved.