开发者

Multiple IDE debugging in Eclipse

First off I'm not a Java expert by any stretch, nor am I a regular Eclipse user. Due to personal circumstances of a member of our team I have had to step into the breach and fix some bugs in two java applications currently under development.

We have a core application (CORE) and an API which includes a reference to that CORE. What I need to do is debug the API but step into the CORE code. I have all the source code for both projects loaded into the IDE but I ca开发者_JAVA技巧n't hit breakpoints in the CORE. I'm assuming it is using the jar version of the CORE included in the API as opposed to the code in the CORE.

I hope that makes sense.

Cheers


Define a breakpoint in the API by clicking on the left side column of the editor. Then, try to step into a function of CORE. Eclipse will complain that it cannot find the sources to debug. However, a button will appear that will let you define where to find these sources: either in a jar file or in an external directory.

If you were to include the sources of CORE along with the classes of CORE, normally eclipse will find it automatically as well.

Cheers


I have all the source code for both projects loaded into the IDE but I can't hit breakpoints in the CORE. I'm assuming it is using the jar version of the CORE included in the API as opposed to the code in the CORE.

Change the build path of the second project so that instead of referring to a packaged JAR of the first project, it refers to the project itself.

In the properties of the second project, go to Java Build Path, remove the JAR from the Libraries tab, and add the first project under the Projects tab.


What you need to do is remote debugging. Here is one (of several) articles covering that topic and showing how to set up a remote debugging session. (near to the end of the text)

Basically you start the application with some extra parameters while on eclipse you have a projects that contains the source code. Then you start a remote debugging session and can set breakpoint, inspect variables, etc. on the remote JVM.


You probably have the CORE java classes which are compiled by Eclipse to byte code and present in the IDE. THat means that the code invoked by the API is most likely NOT the code you think as it is probably present in jar files next to the API.

What you need to to is to attach the sources to the jar files instead in their properties. Either zip them up and attach that zipfile or attach the folder where the "com"/"org" etc package names start.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜