Tuesday, January 1, 2013

How To Debug From Eclipse The Remote Java Applications - Improve Development Productivity

Debugging code you have written would be a very time consuming process if not debugging techniques are not used. Eclipse IDE is most preferred for developing Java Programs these days and eclipse comes with the feature of configuring and using the debugger.Using debugger, developer need not spend time placing Sys out statements in the code, run the program and see the console for print outputs. This method of debugging becomes a nightmare when you are dealing with complex java projects. Building and running such applications take considerable amount of time. In this post I'm going to show how to configure and debug the remote java programs.

1. Build the Java Application Jars using -g command line argument to generate only some debugging info
2. Run the remote java application using JVM debug options as java @agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=y -jar remoteJavaApp.jar
3. Start remote debugging through eclipse with source code attached. From debug configuration create settings for 'Remote Java Application' using the port address and attach the source code of our application.

Under Eclipse define debugger as shown in the following picture,

 

Configure External (Remote) Java program as shown below
  
 

Enter remote Java application details in the new configuration as shown below.


Click run button to launch the remote java application and then attach the Eclipse debugger from the "Debug" icon and there you go debugging your remote java application.

Related Posts Plugin for WordPress, Blogger...