[英]Eclipse Debug: Source Not Found while remote debugging
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. 在我的Java eclipse项目中,当我进行远程调试时,即使源文件jar正确映射到库文件,eclipse也不会进入导入库文件的类文件。
Instead it gives me a " Source Not Found " error. 相反,它给了我一个“ 未找到来源 ”错误。 But when I am editing the same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.
但是当我在eclipse中编辑同一个类时,我可以控制 - 单击一个类或方法名称,它会将我带到正确的库类文件。
Can anyone please tell me what I am doing wrong? 谁能告诉我我做错了什么?
I am using Tomcat 6 and latest Eclipse Java EE. 我正在使用Tomcat 6和最新的Eclipse Java EE。
In this scenario just follow the following steps: 在这种情况下,请按照以下步骤操作:
In the Java build path for the project, under the sources tab, check if your class path is under the included list. 在项目的Java构建路径中,在sources选项卡下,检查您的类路径是否在包含列表下。 If its under the excluded list, remove it from there.
如果它在排除列表下,则从那里删除它。
As Saury said, get your debug configuration right. 正如Saury所说,让你的调试配置正确。 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.
验证您是否选择了要调试的项目,它对应于应用程序容器中已部署的WAR / EAR / JAR的版本。
I faced same issue and got solved by below steps in eclipse. 我遇到了同样的问题,并在eclipse中通过以下步骤解决了。
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.
事实证明我错过了CentOS上的开发包。
In my particular case, the following yum statement solved the problem. 在我的特定情况下,以下yum语句解决了这个问题。
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. 使用“ Debug Cofigurations ”源选项卡或“ Edit Source LookUp path ”选项附加正在运行的代码的源 。
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). 注意:您需要附加内部项目的src文件夹而不是目标 ,以使其工作(请查看下面的屏幕截图)。
Eg 例如
An update for eclipse Oxygen (Feb 2018): eclipse Oxygen的更新(2018年2月):
Attaching the Java projects (sub projects) also worked well; 附加Java项目(子项目)也运行良好; eg:
例如:
检查选择正确项目的“调试配置” - >“远程Java应用程序” - >选项卡“连接” - >“项目”。
Here is how it worked for me. 这是它对我有用的方式。 Did this on Eclipse oxygen
这是在Eclipse氧气上做的吗
This worked for me like a charm 这对我来说就像一个魅力
Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. 使用Eclipse版本Oxygen.2(2017),接受的答案对我不起作用。 The following procedure was successful.
以下程序成功。
Launch the application to debug with the Xdebug
and Xrunjdwp
switches. 启动应用程序以使用
Xdebug
和Xrunjdwp
开关进行调试。
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. 在Eclipse中创建一个新工作区。
Create a new Java project using File -> New -> Java Project. 使用File - > New - > Java Project创建一个新的Java项目。
Copy the source code of the Jar to debug to the src folder of the new project. 将Jar的源代码复制到调试到新项目的src文件夹。 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. 对我来说,这意味着将\\ com \\ test ...复制到我的src文件夹。
This puts all the source code in the build path. 这将所有源代码放在构建路径中。
Copy any dependency JARs to the project. 将任何依赖项JAR复制到项目中。 I created a new folder named myJARs.
我创建了一个名为myJARs的新文件夹。
Refresh Package Explorer to see the new myJARs folder. 刷新包资源管理器以查看新的myJARs文件夹。
Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs... 通过打开文件 - >属性 - > Java构建路径 - >库(选项卡),将依赖项JAR添加到构建路径,然后单击添加JAR ...
Add each dependency JAR to the list, then click Apply and Close. 将每个依赖项JAR添加到列表中,然后单击“应用并关闭”。 This adds the JARs to Referenced Libraries.
这会将JAR添加到引用的库中。
Configure a debug session. 配置调试会话。 Click Run -> Debug Configurations -> Remote Java Application.
单击运行 - >调试配置 - >远程Java应用程序。 I set
Connection Type = Standard
. 我设置
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). 配置主机以指向运行JAR和端口的计算机到命令行开关的
address
部分中指定的端口(在我的示例中为8500)。
Notice that on the Source tab, both the source files and the dependency JARs are present. 请注意,在“源”选项卡上,存在源文件和依赖项JAR。
Click Apply, then Debug. 单击Apply,然后单击Debug。
View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug. 单击Window - > Perspective - > Open Perspective - > Debug查看调试透视图。
Place breakpoints in the source code. 在源代码中放置断点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.