exception problem

I've written a small class to email information to a given address. I had this class implement Runnable as it will run in a multi user environment.

I need to throw some exceptions if it fails to send the mail but the compiler won't let me throw these ..... the class declaration looks like this:

public class MailSender implements Runnable throws SendFailedException, MessagingException, Exception

and when I try to compile the error message says it expected to find an opening brace, ie. '{', before the 'throws SendFailedException....' bit.

I have another class which is basically the exact same in principal, it implements Runnable and throws an I/O exception, which compiles no problem....this is really bugging me.

Any help greatly appreciated on this one,

Niall.

[817 byte] By [niallgc] at [2007-9-27 18:55:57]
# 1
You don't throw Exception's from the class declaration, you throw them from methods
plucien at 2007-7-6 20:52:43 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
Thanks I've done this and now have another problem.....how to get the run() method to pass an exception back to its calling program.....is this possible or does it have to be approached differently?
niallgc at 2007-7-6 20:52:43 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
It can't throw an exception, but you can extend Runnable so you have an Exception member variable that stores exceptions thrown inside your run method.
StarTurtle at 2007-7-6 20:52:43 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...