Reputation: 747
I have got two projects setup in my eclipse and I am currently remote debugging one of them. However, the one I am debugging uses functionality provided by the second eclipse project and I would like to debug the second project also. When I setup the remote debug configuration for the second project to the same port as the first one, I get an error saying, 'Connection refused'. I am guessing when I use 'Socket attach', I can only remote debug one project.
I would like to know how I can setup my debug configuration in such a way that I am able to debug both projects at the same time
Thanks
Upvotes: 4
Views: 8750
Reputation: 349
You can create a Project B Packages which are required in Project A by simply clicking on
new -> package
.
Further Right Click on Created Package in Project
A -> Import -> Select File System(as an import source) -> -> Browse Source Directory
where the package is located in Project B -> Tick Checkbox beside Package Name -> Finish
Package in Project B will be copied in Project A.
It works for one remote and a java application project.
It worked for me.
Upvotes: 0
Reputation: 719336
You can't attach a second debugger to a JVM. But you shouldn't need to do it either. The Eclipse debugger shouldn't care which of the projects in your workspace that the code is coming from.
(I guess you might actually mean that you have your code in multiple workspaces. In that case, you may need to use Change Source Attachment to allow the debugger in the current Eclipse workspace to see the source code in the other one.)
Upvotes: 6
Reputation: 12534
It would be helpful if you described how the 2 projects are deployed. Are they running in 2 separated processes or are they in the same process?
When you are in a Remote Debug session in Eclipse, you are not debugging a project - you are debugging a remote process (as specified by hostname and port). Yes, Eclipse asks you to select a project, but that is only as a starting point for Eclipse to associate breakpoints with source code. You can always change the source attachment.
So assuming you have 2 projects, A and B, both of which have code deployed in the same remote process, you only need a single remote process. If your chosen project is A, and you try to step into code from project B, Eclipse might tell you that it cannot find the source. To fix, this, you need to do the following:
Upvotes: 2