GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes A problem with the run method of java.awt.EventDispatchThread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "A problem with the run method of java.awt.EventDispatchThread" Watch "A problem with the run method of java.awt.EventDispatchThread" New topic
Author

A problem with the run method of java.awt.EventDispatchThread

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
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,
Alejandro Barrero
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
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.
 
GeeCON Prague 2014
 
subject: A problem with the run method of java.awt.EventDispatchThread