Eclipse debugging “source not found”

前端 未结 6 1895
南旧
南旧 2020-11-29 05:50

I just started using Eclipse so go easy on me ;). But when trying to debug a JUnit test case I get a dialog that states the the source is not found when I get to this line i

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 06:35

    The debug callstack will display a JUnit source code line when throwing an exception.
    But you should not need to worry about that, if you do not have the source code of JUnit.

    If you go back one line in the callstack, you should see the line (of your source code) which has caused the JUnit exception.
    That should be enough to debug your code.


    To associate the source with JUnit, you could add the junit.jar in the librairies of your project, and associates the junit-x.y.z-src.jar to the junit-x.y.z.jar, like so:

    http://web.archive.org/web/20130227201940/http://img241.i_mageshack.us/img241/1412/eclipsejunitsrc.png

    That will generate in the .classpath of your project a line like:

    
    

    Note: actually, there would be the full path of the junit[...].jar files in this classpathentry line. But you could also use Linked resources to avoid that fixed value (the full path) in your .classpath file.

提交回复
热议问题