Pétur Ingi Egilsson
Pétur Ingi Egilsson

Reputation: 4442

How to enable remote debugging for an Eclipse Application?

Im trying to enable remote debugging for an eclipse plugin project, for the purpose of using IntelliJ IDEA as a debugger.

The steps I've taken so far:

  1. Launch Eclipse.
  2. Run -> Debug Configurations...
  3. Create a new "Eclipse Application" (as to launch a local workspace which loads the plugin).
  4. Add -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n to VM arguments.
  5. Press the Debug button.

I get the following error:

ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options. Error occurred during initialization of VM agent library failed to init: jdwp

What steps should I be taking to get IntelliJ IDEA to be able to debug an Eclipse Plugin running in a runtime workspace?

enter image description here

Upvotes: 4

Views: 24278

Answers (4)

freshNfunky
freshNfunky

Reputation: 69

by just adding

-Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n

at least Java applications based on eclipse framework do ignore these arguments then. you need to add -vmargs ahead like:

-vmargs -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044

Then, when you start the app via console it should print:

Listening for transport dt_socket at address: 1044

you then could start the external debugger e.g. from eclipse

Upvotes: 1

sumit singh
sumit singh

Reputation: 57

Tomcat Configuration:-> By default remote debug happens at 8000 port.If you want to change this then go to catalina.bat file and update this line set JPDA_ADDRESS=localhost:8000 to desired port no. And you can also set this property in setenv.bat file. Generally this file is not there in tomcat so just create one batch file with name setenv and write this line set JPDA_ADDRESS=localhost:8000.

Now go to bin directory then open command promt and write "catalina jpda start". It will make the tomcat run in debug mode. You can verify it by seeing something like this "Listening for transport dt_socket at address: 8000"

1)Eclipse

Go to run->debug configuration->Remote Java Application->Click on new Launch configuration And then fill the detials like project ,port(Give same port no as you have configured in tomcat), host(If you are using local you can give local then apply and debug I am using eclipse 2020.09 .

Eclipse remote debug img

2)Intellij Idea:

Go to Add configuration->click on +->and select remote jvm debug->Then give the same port no and name(any name) then apply.

Intellij Idea Remote Debug img

Upvotes: 0

the8472
the8472

Reputation: 43042

  • Run -> Debug Configurations...
  • Add -Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n to VM arguments.

This is redundant. Using a debug configuration already starts the application with the eclipse debugger attached to the process. Start it as a run configuration instead if you want to enable debugging through a server socket.

You can then create an additional "remote java application" debug configuration to attach to that socket.

Upvotes: 4

David G
David G

Reputation: 4014

I would suggest you NOT try to launch the Eclipse app from within Eclipse.

  • Export the app to be a stand alone eclipse application.
  • Modify the eclipse.ini file and add the necessary debug parameters to the '-vmargs' entry.
  • Launch the stand alone app as you normally would.
  • Attach the development Eclipse instance to the test app as you would normally do for a remote debug.

Upvotes: 2

Related Questions