Debug "Step into" class calls cause "Class not found" exception - Eclipse Debugging

3.4k views Asked by At

I had a brain meltdown over this problem last night. I started to debug my program after making sure there were no clear errors coming from my eclipse error check. I'm using Jre7 by the way. Anyway, each time i stepped into my class call(lets call it "a") the debugger would trip and say "class not found". However if i just run the debug without stepping into anything, there is no exception. Also if i step over the class call line, the program still initiates the class and all its members, and doesn't throw any exception. It is only when i reach that initial call " classA a = new A(); " that it stops and throws an exception. It also did this for a subclass I made inside of A. I couldn't step into that class either.

What types of things can cause this?

1

There are 1 answers

2
Jim Garrison On

This is normal behavior. The first time you instantiate a class, internally there will be a ClassNotFoundException. If you examine the stack trace at that point you'll see you're about 7-8 levels deep from where your instantiation occurs. Press the key for "step out" enough times and you'll eventually get back to your instantiation point. The exception was caught by the classloader, the class was loaded, and you are ready to proceed.

The debugger behaves this way because it must be able to debug classloader problems.