pyrrhic
pyrrhic

Reputation: 1897

Add Java Exception Breakpoint does not show any matches in Eclipse

When I try to add a Java Exception Breakpoint, I get a blank white screen with no "Matching items:" At the bottom I don't have a package symbol. Is there any way I can configure Eclipse so I can add a breakpoint corresponding to a Java Exception? I am remote debugging.

Upvotes: 3

Views: 1706

Answers (4)

buzz3791
buzz3791

Reputation: 1734

I had this problem with Eclipse Neon and JDK 1.8u131. I had created a new workspace and imported only Maven projects. When I tried to add an exception breakpoint, the Matching items area were blank.

The currently accepted answer of "adding the JDK's rt.jar" did not fix the problem for me.

What did work is the following:

  1. Find a "runnable" Java class in one of the imported Maven projects; runnable meaning: a class with a main() method.
  2. Right-click on the "runnable" class
  3. From the right-click menu, select Run As->Java Application.
  4. Eclipse kicks off an index operation.
  5. Click on the Debug perspective and click on the Breakpoints view's Add Java Exception Breakpoint toolbar icon.
  6. Eclipse displays exceptions in the Matching items area populated normally.

The specific version of Eclipse on which I had this problem is:

Eclipse Java EE IDE for Web Developers.
Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
Windows 10 64-bit anniversary update

Upvotes: 0

Daniel Sokolowski
Daniel Sokolowski

Reputation: 12468

For me the cause was that the nature of the project the .target file resided in lacked a Java nature, that is it was just a 'Generic' project.

Open the normally hidden .project file and modify the <natures> section by adding the java nature as in the snippet below then re-open your project.

...
<natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
...

Upvotes: 1

eis
eis

Reputation: 53462

I have experienced the same behaviour. The build works otherwise fine, and JDK is in the build path. Eclipse Kepler SR 1, Windows 7.

For me, the dialog started to work when I went to Run -> Debug Configurations -> [my debug configuration] -> source tab and added [myjdkpath]/jre/lib/rt.jar there manually. After doing that, the other exceptions appeared as well.

When I removed it again after adding, I was still able to see all my exceptions like supposed to. I guess you can just add any library there, debug, and remove it for Eclipse to "refresh" itself.

Upvotes: 1

user573215
user573215

Reputation: 4697

When I open up the "Add Java Exception breakpoint" dialog window, there is already "Exception" displayed in the input field and all exceptions eclipse knows are listed.

You should type in the name of the exception into the input field. If you don't know the exact name you should write lower-case and you can use "*" as a wildcard.

Then the types matching that name should occur in the list and you can choose them for your breakpoints.

Be aware that these special breakpoints may slow down the debugged process signifiantly. So don't forget to remove them after debugging. This is a lesson I learned the hard way. ;)

Upvotes: 0

Related Questions