0

I have a strange bug when I try to debug my code using the eclipse debugger. I was debugging it for while and added some javadoc comments. Ever since the debugger doesn't show me the exact line anymore.

enter image description here

So I set a breakpoint in line 278 at the beginning of the "bibliographyChicago()" method, but the debugger shows me line 218. But in the top left it shows me, that the method I set the breakpont at is at 218:

enter image description here

When I try to iterator through my code step by step now it does what the code should do, as I can see in the variables window, but it is still in wring lines and while iterating even in wring files.

Is this any known bug or does someone knows how to fix it? I have this issue at both, Eclipse Neon 1 and 2, but only since i added the javadocs.

Thanks in advance.

Edit: Here is a screenshot of the package explorer of eclipse.

enter image description here

derfium
  • 173
  • 1
  • 3
  • 15
  • 2
    did you try to clean and rebuild your project? – TmTron Mar 04 '17 at 14:23
  • The debugger uses the information it has in the compiled code that it runs. If you change the source code while debugging, of course it will go out of sync with the compiled information. – RealSkeptic Mar 04 '17 at 14:29
  • @TmTron I don' know what you mean by rebuilding, but cleanup didn' work, I already tried that. – derfium Mar 04 '17 at 14:44
  • @RealSkeptic of course I saved it. – derfium Mar 04 '17 at 14:45
  • 1
    in Eclipse press : `Project` - `Clean...` will delete all java class files. Then click `Project` - `Build All` to build everything again. Now the generated class files should match your source code. – TmTron Mar 04 '17 at 15:01
  • @TmTron well, no it cannot find of load my main class anymore? – derfium Mar 04 '17 at 15:06
  • Then there's something very wrong with your project setup. Maybe your files are in a wrong folder or something like that. Can you post the project on github or a screenshot of the files (maybe the eclipse package-explorer view)? – TmTron Mar 04 '17 at 15:18
  • @TmTron I don't want t post it on github for it is the final exam of my course in university ;) I edited the main post and added the package explorer. – derfium Mar 04 '17 at 15:31
  • and what error-message do you get now? – TmTron Mar 04 '17 at 15:37
  • @TMTron Error: Could not find or load main class. – derfium Mar 04 '17 at 15:58
  • http://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean – TmTron Mar 04 '17 at 16:04
  • 1
    Ok I found my problem. I am testing my program with JUnit and Hamcrast, but after rebuilding it could not find the hamcrest jar file. After removing it form the build path it works again and also the debugger now shows the correct line. Thanks a lot @TmTron ! – derfium Mar 04 '17 at 16:06

1 Answers1

0

When your're in the debug mode, adding lines to the code will not be taken in a concideration, save your file and restart the debug, you'll find the new lines. Note that also, if you initialize a variable that you don't use, you'll not find it in debug mode (Eclipse Memory Optimisation=

Sofiane
  • 473
  • 1
  • 6
  • 13