Debugging Applet code using Eclipse

For last one month I involved in an applet development work. Its been hard to debug and fix issues in applet code as I have to use System.out.println() to see debugging information, it is very hard and time consuming, often I have to redeploy applet code when after adding a few more System.out.println. Felt my development time is wasted so started looking around solution to debug applet code. I came across an article in IBM site to debug java code remotely using eclipse.

Here are the quick steps:
a) Added the following parameters into Java Applet runtime setting.
-Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:9000,suspend=y
b) Started the debugging server in “Socket Listen” from eclipse.
c) Ran my applet code over the browser I could see my breakpoints in eclipse worked perfectly.
Reference: http://www.ibm.com/developerworks/java/library/os-eclipse-javadebug/index.html?ca=drs-

Here is some information to configure applet runtime parameter:

goto Windows Start > Control Panel > Java > Java (tab) > View (button) > Java Runtime Parameters.

control-panel

As request, here is the eclipse configuration screen print. The connection type should be “Socket Listen”.

eclipse-debug-window

Advertisements

11 Responses to Debugging Applet code using Eclipse

  1. Rajiv says:

    Hi Venkat,

    I am running in the same issue. I tried the steps mentioned here but I am getting Connection refused message from eclipse. Can you please provide screenshot of how you configured the eclipse side for it?

    TIA,
    Rajiv

  2. Venkat says:

    Added eclipse screen print. Make sure the connection type is “Socket Listen”.

  3. Rajiv says:

    Thanks.

    I guess that is the difference. My eclipse debug dialog shows only “Socket Attach” option. How do you get the “Socket Listen” option?

  4. Rajiv says:

    Never mind. This new option is available with eclipse 3.4.1 onwards.

    It worked for me with the new eclipse.

    Thanks.

  5. David says:

    This is my first time debugging an applet, and it appears that you can debug it completely using the built-in applet viewer.

    I understand that you may wish to use a browser, depending on your application, but it’s refreshing to know that you can keep an applet completely within Eclipse for debugging.

  6. jeyaseelan says:

    i could not connect to 9000 port. it says, waiting for vm to connect 9000 port. what to do for this?

  7. Grady says:

    After moving to 64-bit windows (Windows 7 x64) I was having trouble getting this working. I noticed that when I went to java control panel that it was running as 64-bit process. I believe the switches I set were only affecting 64-bit and I am running my applet in a 32-bit Firefox. I wasn’t sure how to get to the 32-bit control panel so I uninstalled 64-bit java from my system. After uninstalling 64-bit java it became a 32-bit process and when I added the switches there the debugging started working.

    I realized after the fact that perhaps if I had accessed the java settings from the system bar then I probably would have been changing the 32-bit settings. I’m sure there’s also a way to access the 32-bit settings on a system that has both but in control panel it only offered the 64-bit. Maybe someone else here knows how to do that.

    I hope this helps others who run into the same problem.

  8. Aparna M says:

    Hi

    I tried the above steps But I am getting connection refused message. Please help!!!

  9. vitor says:

    i think the problem of VM connection refused message, is because, or you dont have your applet opened(in the browser) or you have you apllet in another page that not the first one. Well that wa my problem, now works perfectly!!!

  10. Carmela says:

    I read a lot of interesting articles here. Probably
    you spend a lot of time writing, i know how to save you a lot of work, there is
    an online tool that creates unique, google friendly articles in seconds, just type in google – rewriter creates an unique article in a minute

  11. devanshu says:

    I am looking into a issue which is regarding back button.I have been trying applet debugging but my issue is not reproducible in applet debug mode. When i download the applet without the “-Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:9000,suspend=y” string, the issue comes up however when i put the string, clear the cache and again download the applet,the issue does not comes up. What could be the problem? could it a JRE issue?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: