Eclipse Remote Debug, specially for Applet

来源:互联网 发布:java交互sqlserver 编辑:程序博客网 时间:2024/05/29 16:49
<script type="text/javascript"><!--google_ad_client = "pub-1992382271196226";/* 728x15, 创建于 08-9-3 */google_ad_slot = "9127232582";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

---from    Attaching a debugger to a Java Applet

I had to do this the other day, so I thought I’d pop it here for reference.

First of all, set up the Java plugin, via the Control Panel inWindows. For the JDK 1.3 plugin, navigate to the basic tab, and enterthese settings in the runtime parameters box:

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

The ‘dt_socket’ parameter here sets up a TCP port for a debugger to attach to. The 2502 can be any TCP port you like.

Settings for JDK 1.3

For JDK 1.5, its a bit different, select the Java tab in the controlpanel applet, and click on ‘View’. Enter the above settings in the Javaruntime parameters cell.

Settings for JDK1.5

Navigate to the page with your applet in your browser. You should now be able to attach a debugger.

I use Eclipse as my Java IDE, but this should work in the likes of Netbeans and IntelliJ IDEA as well.

First of all, set some breakpoints in your application, else you won’t have much to debug ;-)

In Eclipse, select ‘Run’ and then ‘Debug…’. Create a new ‘RemoteJava Application’. Select the TCP port you entered above (2502).

Eclipse debug settings (1)
Add the source for your project on the source tab.

Eclipse debug settings (2)

Click the debug button and away you go.

原创粉丝点击