【正文】
hat implement a Java IDE supporting the development of any Java application, including Eclipse plugins. ? Check out the Remended Eclipse reading list. ? Browse all the Eclipse content on developerWorks. ? New to Eclipse? Read the developerWorks article Get started with Eclipse Platform to learn its origin and architecture, and how to extend Eclipse with plugins. ? Expand your Eclipse skills by checking out IBM developerWorks39。 } } 2. Set a breakpoint Set a breakpoint in the code. In this example, we set the breakpoint in the line (This is a test.)。s do it step by step: 1. Create a Java project with a simple class We create a simple class for debugging purpose. Listing 4 shows the sample code. Listing 4. Sample code for debugging package 。t discuss the details of JDI implementation. See Resources for information about Eclipse JDT and Java JDI technology. The first thing we want to know is which Eclipse connector to use. To learn the remote connection types provided by Eclipse, you can add a launch configuration in Remote Java Application by going to the Eclipse menu and selecting Run Debug Configurations..., then selecting the connector from the dropdown list. Two connectors are provided in Ganymede: ? Socket Attach ? Socket Listen For the socketlistening connector, the Eclipse VM will be the host to be connected by the remote Java application. For the socketattaching connector, the target VM will be the host. There is no difference for application debugging between the two connectors — the user may choose. A good rule of thumb is to use the faster, more powerful puter as the VM debug host because of the putational resources required. Before debugging your Java application, you may need to make sure the debug options are all enabled for your remote application. If that information is not available, you will get an error message, such as Debug information is not available or Unable to install breakpoint due to missing line number. You can modify the settings from the Eclipse menu by changing what39。 Windows174。s JPDA specification. The JDI is a highlevel interface to define the information and requests used for remote debugging. The architecture is structured as follows. Listing 1. The Java Platform Debugger Architecture Components Debugger Interfaces / || / | VM | debuggee ( || JVMTI Java VM Tool Interface \ | backend | \ || / | m channel ( | JDWP Java Debug Wire Protocol \ | / || / | frontend | debugger ( || JDI Java Debug Interface \ | UI | \ || Therefore, any thirdparty tools and VM based on JPDA should work together without plaint. This clientserver architecture allows you to debug a Java program from a local workstation running the platform, or even debug it from a remote puter on your work. Before talking about the debugscenario stuff, we need to introduce two terms used in the JPDA specification: connector and transport. A connector is a JDI abstraction used to establish a connection between a debugger application and a target VM. A transport defines how applications access and transmit data between the front end and back end. The connectors map to the available transport types and the modes of connection. In Sun39。s designed for use by debuggers in any environment. JPDA is not only for desktop systems but works well with embedded systems, too. The JVM Tool Interface (JVMTI) defines that a VM must provide for debugging. (Editor39。s debugging features. See Resources for more information about debugging with Eclipse and where to find the aforementioned software. JPDA introduction Sun Microsystems39。 J9 or Sun Microsystems39。t have it already, download Eclipse (Ganymede). In Ganymede, the socket listening connector has been added to the Remote Java Application launchconfiguration type. Eclipse39。Debug Java applications remotely with Eclipse Use the power of the Eclipse IDE to spread around your Java application debugging Level: Intermediate Charles Lu (), Software Engineer, IBM 09 Dec 2020 You don39。t need to debug Java? applications on just your local desktop. Learn how to spread around your debugging using different connection types that make up remote debugging. This article explains the features and examples that show how to set up remote application debugging. Remote debugging can be useful for application development, such as developing a program for a lowend machine that cannot host the development platform, or debugging programs on dedicated machines like Web servers, whose services cannot be shut down. Other examples include Java applications running with limited memory or CPU power, such as mobile devices, or developers wanting to separate t