This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
Some methods in my program throw Exceptions that extend RuntimeException (I don't want to catch them), but the program is executing the run method of java.awt.EventDispatchThread repeatedly (the program would not terminate). I am using Java 1.6. My code is simple:
When the exception is thrown in MyEclipse, running the debugger, the program keeps breaking in the run method of java.awt.EventDispatchThread. Without the debugger, the application never opens.
Your help will be greatly appreciated,
Well, if you get an exception then you should find the cause (from the stack trace) and solve it.
But I think that using an unchecked exception instead of a checked exception just so you won't have to catch it is bad design. If the exception comes from some outside-world environment where you don't have much control over (like the file system, the network, a database), a checked exception is really the way to go. Unchecked exceptions should be used if you can prevent them with some checks.
Thanks Rob. I know exactly what is the cause of the exception and I am using an UncaughtExceptionHandler, but it will only be triggered if the exception makes the program terminate. This is my actual problem, but I didn't want to dwell on it because the real issue is that the exception is triggering the run method of java.awt.EventDispatchThread repeatedly.