简体   繁体   English

调试时找不到源

[英]source not found when debugging

I'm using the Eclipse IDE for Java EE Developers (Mac OS X 64 Bit) to debug my two java documents. 我正在使用面向Java EE开发人员的Eclipse IDE(Mac OS X 64位)来调试我的两个Java文档。 I have a Name class with a method named insert . 我有一个Name类,带有一个名为insert的方法。 It executes but gives wrong result. 它执行但给出错误结果。 NamesTester is test class for Name class. NamesTesterName类的测试类。

During debug, when I using step into the insert method, it jumps to a strange document named ArrayList<E>.size() , and it shows Source not found. 在调试过程中,当我使用step进入insert方法时,它跳到一个名为ArrayList<E>.size()的奇怪文档,并且显示未找到Source。 I don't know what's wrong. 我不知道怎么了 Does it means I can not step into a method to see what is happening there? 这是否意味着我无法进入一种方法来查看发生了什么? But if I use step over, it's debugging next steps fine. 但是,如果我使用单步执行,则可以调试后续步骤。

Can someone help me in finding the reason and solution? 有人可以帮助我找到原因和解决方案吗? Thank you! 谢谢!

It means you jumped into a class definition your project classpath has no access to. 这意味着您跳入了您的项目类路径无法访问的类定义。 For example Java JVM source code. 例如Java JVM源代码。 In your case, perhaps it tried to jump into ArrayList definition. 在您的情况下,也许它试图跳入ArrayList定义。

Look out thru google about debugging in eclipse, step into and step thru 通过Google了解有关Eclipse调试的信息,并逐步了解

You debugged into the Java runtime code, but you don't have its sources installed on your machine. 您已调试到Java运行时代码,但未在计算机上安装其源代码。 The most simple way to avoid that in the future is to install a full Java development kit (JDK) instead of only a Java runtime environment (JRE) and to make sure that Eclipse uses that JDK. 将来避免这种情况的最简单方法是安装完整的Java开发工具包(JDK),而不是仅安装Java运行时环境(JRE),并确保Eclipse使用该JDK。

The method you pointing to ArrayList.size() , is a method of ArrayList class of jdk. 您指向ArrayList.size()的方法是jdk的ArrayList类的方法。

First : source not found is not an error. 第一:找不到源不是错误。 source not found comes when you are in debug mode and while debug you enter some class whose .java file is not located on classpath. 当您处于调试模式时,找不到调试源,而在调试时,您输入某个类,其.java文件不在类路径中。 This message just means that , the part of code you are trying to debu, source cide for that is not available and thus the debugger cant show the highlighted line etc. Now to correct this, i mean be able to see that method in your debugger, download the source code for jdk(the same version that you are using currently) and when you see the source not found screen , there is a atrach source button.select that and select the source code file you have downloaded and press ok. 该消息仅表示,您尝试调试的部分代码,源代码无法使用,因此调试器无法显示突出显示的行等。现在要更正此问题,我的意思是能够在调试器中看到该方法,下载jdk的源代码(与您当前使用的相同版本),当看到未找到源屏幕时,有一个atrach源按钮。选择该按钮,然后选择已下载的源代码文件,然后按OK。 and tge screen will refresh with the highlighted line of the class. 然后tge屏幕将以该课程的突出显示的行刷新。

  1. click Attach source 单击Attach source
  2. Check External locations and click External files 检查External locations ,然后单击External files
  3. add src.zip from Program Files/java/jdk1.x/src.zip 添加src.zip从Program Files文件/ JAVA / jdk1.x / src.zip

I think you need to attach source code to the library, this will help the debugger to find it. 我认为您需要将源代码附加到库中,这将有助于调试器找到它。

follow this thread section 16.2, 遵循此线程第16.2节,

hope this will help you. 希望这会帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM