I'm debugging from a maven project, and found that I need another project opened, Project2, so I opened it. I tried adding a debug point but got the error "Breakpoint's source file does not belong into the preferred source root". I looked at Windows->Debugging->Sources and I see the Project2-sources.jar from the maven repository, but not for Project2 that I just opened from a checkout subversion directory.
I disconnected from the debugging session, then close, then open Project2. It then works. It looks like Opening a project is not updating a live debugging session.
This also happened to me. When it happened to me I was debugging and I had two classes in my workspace, same name, same package, but different projects.
The breakpoint I was trying to add was in the file listed 2nd in debugging sources. I moved the project containing the file to which I wanted to add the breakpoint to the top of the list and it worked.
Meet same problem today in Netbeans 7.1RC1, and followed savan's workaround, and it worked.
But I think this should be resolved if possible in future release.
Same problem when debugging: Breakpoints were not reachable.
in my situation problem occured this way:
1.)i checked out a Project via subversion and created a Netbeans Project with Existing Sources
2.)created a totally new Project in NetBeans
- wrong Classpath, when rightclicked on one of the classes where the breakpoints were not reachable, were shown
- the Classpath of the last checked out project were shown (not the one of the actual project)
3.)rightclicked the Netbeans Project and in Properties/Libraries removed the wrong entry in the "Compile-time" Libraries
4.)debuger worked as usual
Could this perhaps be fixed by adding project sources of a new project at the top of the list of breakpoints gaining top priority? Not knowing what the problem is, I would intuitively try to close and re-open the failing project. Moving multiple source packages all the way up from the bottom as suggested as workaround is hard to do at times.