In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files of imported library files even though the source file jars are properly mapped to the library files.
Instead it gives me a "Source Not Found" error. But when I am editing t开发者_开发知识库he same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.
Can anyone please tell me what I am doing wrong?
I am using Tomcat 6 and latest Eclipse Java EE.
In this scenario just follow the following steps:
- Go to Run → Debug Configurations
- Select the remote application configuration being debugged.
- Select the second tab named 'Source'
- Now add the folder/projects containing the source code explicitly here.
In the Java build path for the project, under the sources tab, check if your class path is under the included list. If its under the excluded list, remove it from there.
As Saury said, get your debug configuration right. When remote debugging, often developers have selected the wrong project while creating a new configuration. Verify you select the project you wish to debug and it corresponds to the version of the deployed WAR/EAR/JAR in the appliation container.
I faced same issue and got solved by below steps in eclipse.
- Go to Severs tab in your Eclipse tab
- Right click on the server and click on Add and Remove Projects
- Select/add the project EAR which you want to debug
- After finish - Start your server in debug mode
Should solve with above steps as it resolved for me:)
I ran into a similar problem. It turns out I was missing the devel package on CentOS.
In my particular case, the following yum statement solved the problem.
yum install java-1.7.0-openjdk-devel
Follow the next steps in case you use a parent project connected to sub-project/s:
Use the 'Debug Cofigurations' source tab or the 'Edit Source LookUp path' option to attach the sources of the running code.
Note: you'll need to attach the src folder of your inner project rather than the target in order to make it work (check the screenshot below).
E.g.
An update for eclipse Oxygen (Feb 2018):
Attaching the Java projects (sub projects) also worked well; e.g:
Check under "Debug Configurations" -> "Remote Java Application" -> Tab "Connect" -> "Project" that you chose the correct project.
Here is how it worked for me. Did this on Eclipse oxygen
- Go to debug configurations and then the source tab
- Click on Add
- Select Java Library. Hit ok
- The select Web app libraries and click next
- In the next screen select the project/application that you are debugging.
- Click Finish
This worked for me like a charm
Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. The following procedure was successful.
Launch the application to debug with the
Xdebug
andXrunjdwp
switches.cd "C:\Program Files\Test_742\Test 7.4" test_app.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8500
Create a new workspace in Eclipse.
Create a new Java project using File -> New -> Java Project.
Copy the source code of the Jar to debug to the src folder of the new project. I found it necessary to ensure that I copied the complete folder hierarchy of the source code to my source folder.
For me that meant copying \com\test... to my src folder.
This puts all the source code in the build path.
Copy any dependency JARs to the project. I created a new folder named myJARs.
Refresh Package Explorer to see the new myJARs folder.
Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs...
Add each dependency JAR to the list, then click Apply and Close. This adds the JARs to Referenced Libraries.
Configure a debug session. Click Run -> Debug Configurations -> Remote Java Application. I set
Connection Type = Standard
.Configure Host to point to the machine running the JAR and Port to the port specified in the
address
portion of the command line switches (8500 in my example).Notice that on the Source tab, both the source files and the dependency JARs are present.
Click Apply, then Debug.
View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug.
Place breakpoints in the source code.
精彩评论