Debugging applets is really easy once you get everything setup. We are using Eclipse here to debug the applet. For using other IDEs the procedure is quite similar.
Create a new project in Eclipse and add your applet sources there. Make sure that the Java files are under build path and the files are building correctly.
This is the trick. First open up the Java Control Panel. In Windows you can find this from Windows Control Panel and for Linux you can execute this in the console
This should bring the control panel to the view. Selevt the Java tab and then View from the upper section called Java Applet Runtime Settings. You should see at least one Java Runtime configured. If you have many, select the newest (highes version number). Click on the last column Java Runtime Settings. Enter this string there:
-client -Xdebug -Xrunjdwp:transport=dt_socket,address=6000,server=y,suspend=y
The parameters which we are interested are address and suspend. The address you need to know on the next phase when we start debugging, it is actually the port number we connect. The suspend can have values either y for the yes and n for no. If set to yes, the applet will not start unless you are debugging it. Usually this is the situation we want. If set to no, the applet will load normally and we cannot debug the initialization phase, unless we are already debugging.
In Eclipse change to Debug perspective. You should find it from Window->Open perspective. If there is no Debug, choose Other and select it from the list that appears. Now you should see a button which looks like cockroach. Click on the arrow right next to it. Select Debug... from the list.
Now you are in the debug configuration. On the left you should see Remote Java Application, right click on it and choose New.
On the top there is the Name field, change it to descibe your applet application. For the Project field click Browse on the right and choose your applet project. Finally change the port number to 6000.
Now to start debugging choose Debug on the bottom.
If your applet was already loading, it should start debugging right away. If it says Failed to connect.., you have not started you applet yet. Start your applet and click on the arrow again next to the debug button and choose your debug configuration.