开发者

Debug in Eclipse - ClassNotFoundException

when i debug in Eclipse a simple console application, I get a lot of ClassNotFoundException lines in the debug Window. It is not an error, somewhat lower in another pane I get "Source not found.". I 开发者_运维知识库understand that it is because the source code of the required class is not available, buI would like to skip over these lines... I have to press a lot of times the "step over" or "step out" button to get out of these states.

What can I do in order to avoid these useless lines at all?

Thanks


I've been having this problem for a few months now. I'd be debugging a java app and every time I'd hit a constructor, eclipse would try to find matching java core library ClassNotFoundException's source code.

I solved this problem by right-clicking in Debug window on the ClassNotFoundException when I hit it, and clicking on Filter Type. I would then right-click in the debug window again and choose Edit Step Filters.... In the Edit Step Filters window I checked everything in the Defined Step Filters section and unchecked everything in the bottom of the window (Filter synthetic methods, Filter static initializers, etc).

Hope this helps others in the future.


After Launching Debug Mode.

Go to Window → Show View → Break Points. Now you would be able to see Break Point tab in Debugging mode.

Uncheck the option "ClassNotFoundException: caught and uncaught".


While debugging try Step Return (F7 as shortcut) to get one level up at a time and thus out of the libs you don't have the source attached for.


In a normal application your own code (your java files) is mixed together with code of others (class files in libraries, runtime environment, etc.). Each time you step into a class file you will get this "Source not found"-Warning. (as you already mentioned in your question)

At first you could try to get the source codes for the libraries and link them to your libraries (for example in "project setup => Preferences.../Java Build Path/Libraries => unfold a jar-libraries => Source attachment").

If no source code is available you have to use the debugger-comands to avoid jumping into that class files. "Step Out/Return" might help, but the "Debug View" (which can be found in the top left corner in your "Debug Perspective") could be even more helpful.

In the "Debug View" you can see each thread of your application. If you are currently debugging a thread you can there see the current stacktrace. Instead of clicking F6 and F7 all the time you can also navigate by clicking on an stacktrace-item there.

Tipp: I am using - (Rightclick->"run to line") a lot - this is quite helpful to run over loops, etc.


An occurence of ClassNotFoundException is most common in debugging in order to avoid these exceptions, In breakpoints window(Windows>Show View>BreakPoints) uncheck the "ClassNotFoundException: caught and uncaught" to continue with the normal debugging.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜