简体   繁体   English

Eclipse调试视图中未显示Java源代码

[英]Java source code not shown in Eclipse debug view

I am doing remote debugging of a Java application and using the debug view of Eclipse. 我正在远程调试Java应用程序并使用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: 但是,我没有在下面的选项卡中看到相应的源代码,它说:

Source not found 来源未找到

The source files are already in my Eclipse project and I can see them in the Java view. 源文件已经在我的Eclipse项目中,我可以在Java视图中看到它们。 I have edited the source look up paths and added the *.java files to it. 我编辑了源查找路径并将* .java文件添加到其中。 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. 任何关于此的线索将不胜感激。

For the Run/Debug configuration that you have been using to Remote Debug, have you followed these steps : 对于您一直用于远程调试的运行/调试配置,您是否按照以下步骤操作:

  1. “Run -> Debug configurations…” “运行 - >调试配置......”
  2. Choose the remote config from the tree on the left 从左侧的树中选择远程配置
  3. Click on the “Source” tab 单击“源”选项卡
  4. Click on the “Add…” button 单击“添加...”按钮
  5. 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. 我通常使用Remote Debug运行配置将Add Source as Java Projects Add Source到Run / Debug配置的Source选项卡。 Thus to add a project called so , I would proceed as follows : 因此,要添加一个名为so的项目,我将按如下方式进行:

在此输入图像描述

And when choosing the project, select the two checkboxes : 选择项目时,请选中两个复选框:

在此输入图像描述

To end up with this finally : 最后结束这个:

在此输入图像描述

I have done the below steps and it worked for me: 我已经完成了以下步骤,它对我有用:

  1. Run > Run Configurations 运行>运行配置
  2. Java Application > Click on Source Tab Java Application>单击Source选项卡
  3. Include the project by selecting the option "File System Directory" 通过选择“文件系统目录”选项包括项目
  4. Debugging started showing the source code. 调试开始显示源代码。

You are probably using JRebel which is automatically recompiling and reloading classes. 您可能正在使用自动重新编译和重新加载类的JRebel。 Unfortunately Eclipse Debugger doesn't work with class realoaded in this way. 不幸的是,Eclipse Debugger不能以这种方式使用类实现。 In order to make sure that Eclipse will work fine with the class after changes you have to restart your web application container. 为了确保Eclipse在更改后能够正常运行,您必须重新启动Web应用程序容器。

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

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