August 20, 2008

Debugging Java Applets in Eclipse

Today I needed to debug Java applet running in Internet Explorer from Eclipse. I was not straightforward. Let me share the experience how to do this:

1) First enable remote debugging in the Java Plugin:

a) Start –> Settings –> Control Panel –> Java –> Java Applet Runtime Settings –> View

b) Add the following to the “Java Runtime Parameters”:

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

Java Plugin - Runtime Settings

This will enable remote debuging on TCP port 8000 for all applications running inside the Java Plugin (in Internet Explorer). Make sure this port is not used by other applications.

3) Close all Web browser Windows

4) Put breakpoints in your source code (you need to have an Eclipse project containing the applet source code)

4) In Eclipse create a remote debugging configuration:

a) Run –> Open Debug Dialog –> Remote Java Application –> New

b) Assign host = localhost and port = 8000

Eclipse - Remote Debug Configuration

Press the “Debug” button and enjoy debugging.

Note: Don’t forget to build your applet with debug information (javac -g). I am buidling my applet with ant so I just added <javac debug=”true” … />.

Tags: , , , , , , , , ,

1 Comment »

  1. very useful, thanks for sharing

    Comment by Anonymous — January 18, 2012 @ 17:07

RSS feed for comments on this post. TrackBack URL

Leave a comment