简体   繁体   English

在Eclipse中进行调试:找不到源

[英]debugging in eclipse : source not found

I have a little project (guestbook, google example in java appengine documentation). 我有一个小项目(来宾,java appengine文档中的google示例)。 https://developers.google.com/appengine/docs/java/gettingstarted/creating In this little project i had a problem when i want to do a debug step by step (F5). https://developers.google.com/appengine/docs/java/gettingstarted/creating在这个小项目中,当我想逐步进行调试(F5)时遇到了问题。 The step into doesn't work and i get a message in eclipse "source not found" with a button "edit source lookup path". 进入该步骤不起作用,我在日食中收到一条消息,其中包含“未找到源代码”按钮“编辑源代码查找路径”。

it seems the problem is known because i found similar posts on stack overflow but i didn't find solution for my case and the solution are sometimes quite different (ok ok i keep open minded). 看来问题是已知的,因为我在堆栈溢出时发现了类似的帖子,但是我没有找到适合我的情况的解决方案,而解决方案有时却大不相同(好吧,我保持开放态度)。 It seems there is a problem with the class path if i read this post. 如果我阅读了这篇文章,看来类路径有问题。

In this post (the most complete i found on the topic) there are many things that i tested. 在这篇文章(我在该主题中找到的最完整的文章)中,我测试了很多东西。 Eclipse java debugging: source not found Eclipse Java调试:找不到源

For example, i have changed the definiton in preference>java>installed JRE but it is the same result... I have tried to create a new debug configuration too and many other things in this window. 例如,我更改了首选项> java>已安装JRE中的定义,但结果相同...我也尝试在此窗口中创建新的调试配置以及许多其他内容。 I need help to understand and configure Eclipse, hoping do not have break all my eclipse installation with my different test... tonight i have taken the decision to install a fresh copy of eclipse... but same results.... 我需要帮助来理解和配置Eclipse,希望不要用不同的测试来破坏我的所有eclipse安装...今晚,我决定安装新的eclipse副本...但是结果相同。

I have the conf below... eclipse keepler Release 1 google plugin for eclipse 3.5.1 appengine-java-sdk-1.8.8 我在下面有conf ... eclipse keepler版本1谷歌插件,用于eclipse 3.5.1 appengine-java-sdk-1.8.8

thanks by advance for your help 预先感谢您的帮助

edit 15.01.2014 编辑15.01.2014

the code is almost the same as google code. 该代码与Google代码几乎相同。 In debug mode, the perspective view is open when i get http://localhost:8888/guestbook , the breakpoint is highlighted and if i press F5, i get the error message "source not found" with the button. 在调试模式下,当我获取http://localhost:8888/guestbook时,透视图将打开,该断点将突出显示,并且如果按F5键,将显示错误消息“找不到源”。

package com.example.Guestbook;
import java.io.IOException;
import javax.servlet.http.*;

public class GuestbookServlet extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp)  throws IOException {
        resp.setContentType("text/plain");
        resp.getWriter().println("Hello, world 1");
        resp.getWriter().println("Hello, world 2");
        resp.getWriter().println("Hello, world 3");

        resp.getWriter().println("breakpoint here " + this.myFunction()); // the breakpoint is here
    }


    // this method is not in the original google example
    public int myFunction(){
        int i=10;
        return i;
    }   
}

I sometimes trigger the same error, but there is often a way to avoid it. 我有时会触发相同的错误,但是通常有一种避免它的方法。 The solution in Eclipse is to use F6 (Step Over) instead of F5 (Step Into). Eclipse中的解决方案是使用F6(逐步结束)而不是F5(逐步进入)。 Your breakpoint is probably on a line that calls code in a library outside of your project and it is the library whose source is unavailable. 您的断点可能在调用项目外部库中代码的一行上,而该库的源不可用。 You don't want to step into the external library source code. 您不想进入外部库源代码。

In your source code example, if you cannot single step from the line containing "breakpoint here " when it breaks there, try adding an additional breakpoint on the line containing "int i=10;" 在您的源代码示例中,如果无法在包含“ breakpoint here”的行中单步执行,请尝试在包含“ int i = 10;”的行中添加一个附加的断点。 and then pressing F8 (Resume) instead. 然后按F8(继续)。

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

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