Eclipse 调试视图中未显示 Java 源代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12054838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java source code not shown in Eclipse debug view
提问by user496934
I am doing remote debugging of a Java application and using the debug view of Eclipse. The basic debugging process is working fine and I can see the method stack traces in debug view at the relevant breakpoints. However, I am not seeing the corresponding source code in the tab below and it is saying:
我正在对 Java 应用程序进行远程调试并使用 Eclipse 的调试视图。基本调试过程工作正常,我可以在调试视图中的相关断点处看到方法堆栈跟踪。但是,我在下面的选项卡中没有看到相应的源代码,它说:
Source not found
未找到来源
The source files are already in my Eclipse project and I can see them in the Java view. I have edited the source look up paths and added the *.java files to it. But even then I am not seeing the source code in the debug view where the execution halts. Any clues on this would be appreciated.
源文件已经在我的 Eclipse 项目中,我可以在 Java 视图中看到它们。我已经编辑了源查找路径并向其中添加了 *.java 文件。但即便如此,我也没有在执行停止的调试视图中看到源代码。任何有关这方面的线索将不胜感激。
回答by Ashutosh Jindal
For the Run/Debug configuration that you have been using to Remote Debug, have you followed these steps :
对于您一直用于远程调试的运行/调试配置,您是否遵循了以下步骤:
- “Run -> Debug configurations…”
- Choose the remote config from the tree on the left
- Click on the “Source” tab
- Click on the “Add…” button
- Follow the wizard (add the Project containing the source which is being debugged).
- “运行 -> 调试配置...”
- 从左侧的树中选择远程配置
- 单击“来源”选项卡
- 单击“添加...”按钮
- 按照向导操作(添加包含正在调试的源的项目)。
If so, can you post a snapshot of the Run Configuration
?
如果是这样,你能发布一个快照Run Configuration
吗?
What I have usually done with a Remote Debug
run configuration is Add Source
as Java Projects
to the Source
tab on the Run/Debug configuration. Thus to add a project called so
, I would proceed as follows :
我也通常用做Remote Debug
运行配置是Add Source
因为Java Projects
对Source
在运行/调试配置选项卡。因此,要添加一个名为 的项目so
,我将按以下步骤进行:
And when choosing the project, select the two checkboxes :
并在选择项目时,选中两个复选框:
To end up with this finally :
最后以这个结束:
回答by Arpita
I have done the below steps and it worked for me:
我已经完成了以下步骤,它对我有用:
- Run > Run Configurations
- Java Application > Click on Source Tab
- Include the project by selecting the option "File System Directory"
- Debugging started showing the source code.
- 运行 > 运行配置
- Java 应用程序 > 单击源选项卡
- 通过选择“文件系统目录”选项来包含项目
- 调试开始显示源代码。
回答by Adam Sznajder
You are probably using JRebel which is automatically recompiling and reloading classes. Unfortunately Eclipse Debugger doesn't work with class realoaded in this way. In order to make sure that Eclipse will work fine with the class after changes you have to restart your web application container.
您可能正在使用 JRebel,它会自动重新编译和重新加载类。不幸的是,Eclipse Debugger 不适用于以这种方式重新加载的类。为了确保 Eclipse 在更改后可以与类正常工作,您必须重新启动 Web 应用程序容器。