This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Remote debugging Java applications

Ranch Hand
Posts: 52
  • 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.
I'm THIS CLOSE to ruling the world! Right after reading this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic