Search code examples
javaeclipsedebuggingjarremote-debugging

Debug a jar that is being used by other application from eclipse


I have a Java application that must be launched from a shell script. This application uses a jar library that I want to modify and debug from eclipse. I have tried it and I failed.

What I have tried

I have compile my library to generate the jar. In the folder where the application looks for the mentioned jar, I have renamed the original one and created a symbolik link to mine.

Then, from eclipse, I have done the following:

  • Right click on my jar's project > debug as > debug configurations.
  • Select Remote java Application and Connection Type = Standard (Socket listen)

At this point, I can see a label at the bottom right telling: "Waiting to vm to connect".

Next I have gone to the application's main folder and executed the launcher script.

I am sure that the application is using the modified library because I have added a System.out.printlin("...") and I can see it in the console. Despite of this, the debug mode is not activated in eclipse, and the application is not paused.

Note: I have compiled the proyect with make.


Solution

  • For remote debugging, the JVM that is being used to run the application must be configured to run in debug mode. So you'll need to include those options in the script that's launching your application.

    Having said that, what is so special about the shell script that it can't be converted into a run configuration to launch directly from Eclipse?