I recently moved from NetBeans to Eclipse and I very much miss one great feature – whenever I use method which throws some kind of exception, NetBeans alerted me and I needed to add try-catch and NetBeans automatically generated exception type for me. Is there something similiar for Eclipse?
f.e. : Integer.parseInt(new String("foo"));
NetBeans alerts I need to catch NumberFormatException.
Eclipse doesn’t alert me at all
I am using Eclipse Java EE IDE for Web Developers, 3.5 – Galileo
It most certainly does. You have to hit “save” (CTRL + S) before that, of course.
Of course, you shouldn’t have declared the method to throw that exception (for example
throws Exception)Also make sure you have
Project > Build automaticallyselected.Important: You don’t declare or catch
RuntimeExceptionor its subclasses – these are unchecked exceptions, and for them eclipse rightly doesn’t offer any options.NumberFormatExceptionsis one of these.Try the methods of
FileInputStream, for example, whereIOException– a checked exception – is thrown.(for the record – NetBeans also doesn’t do anything for
Integer.parseInt(..))