• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Remote debugging Java applications  RSS feed

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few problems might happen only on test or production servers. It may not be reproducible in your local machine. In those circumstances you want to connect your IDE to the remote test (or production) servers and do remote debugging.

Java applications can be remotely debugged by following these two simple steps:

1. Pass remote debugging arguments to JVM
2. Configure IDE

Let's review these two steps in this article.

Step 1: Pass remote debugging arguments to JVM

Typically, you would launch your java application like this:

To enable remote debugging you need to pass these additional arguments:

-Xdebug: Enables JVM to do remote debugging.

-Xrunjdwp: Specifies the connectivity details:

transport: Configures transport between application and debugger. It can have 2 values: 'dt_socket' or 'shmem'. 'dt_socket' instructs to socket interface. 'shmem' will instruct application and debugger interace through shared memory region, which is useful only when both application and debugger are running on same machine.

address: Port which will be opened by the application for remote debugging.

suspend: It can have two values. 'y' means application will be suspended until any remote debugger is connected to the application. 'n' means application will not be suspened even if no remote debugger is connected to the application.

Step 2: Configure IDE

Below are the steps to configure Eclipse IDE to connect to your remote application:

(1). Click on the Debug menu icon

         Fig: Click on ‘Debug’ menu icon

(2).  Click on ‘Debug Configurations…’ menu item

(3).  In the left panel select ‘Remote Java Application’

           Fig: select ‘Remote Java Application’

(4). Press the ‘New’ button

           Fig: Click on ‘New’ button

(5). Now you need enter project and connectivity details:

a. In the ‘Name’ field you can enter any name. Example: myapp-remotedebugging

b. In the ‘Project’ field select your applications source code that you want to debug.

c. In the ‘Host’ field enter the hostname in which your application is running.

d. In the ‘Port’ field enter the port number that you specified in step #1. As per this example it would be ‘8000’

              Fig: Enter project & connectivity details

(6). After entering all these details click on the ‘Debug’ button.

That’s it. Now you are all set for doing remote debugging.  Wish you ‘Happy Debugging’. Hopefully, it’s not that painful.


Don’t keep remote debugging JVM arguments ON always, as it has following downsides:

a. Remote debugging mode disables several optimizations that JVM does to application to optimize the performance. All those optimizations will be lost.

b. Remote debugging opens up a port. It’s a security risk, as anyone who can hit the server can initiate remote debugging.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!