My test program :
public class main {
public static void main(String[] args) {
PersonalSMTP.main(args);
PersonalSMTP.addActionEventListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.out.println("New email :)"+arg0.getActionCommand());
}
});
}
I have this error :
Exception in thread "main" java.lang.NoSuchMethodError: com.ericdaugherty.mail.server.services.smtp.SMTPSender.addActionEventListener(Ljava/awt/event/ActionListener;)
Code in my personalSMTP jar file :
public class personalSMTP {
private static SMTPSender smtpSender;
/** The SMTP sender thread */
private static Thread smtpSenderThread;
PersonalSMTP.main() {
//Start the SMTPSender thread (This thread actually delivers the mail recieved
//by the SMTP threads.
smtpSender = new SMTPSender();
smtpSenderThread = new Thread( smtpSender, "SMTPSender" );
smtpSenderThread.start();
}
//***************************************************************
// Event Method
//***************************************************************
public static void addActionEventListener(ActionListener listener)
{
//xxxListeners.addElement(ActionListener.class);
//xxxListeners.addElement(listener);
smtpSender.addActionEventListener(listener);
}
}
public class SMTPSender implements Runnable {
/** Listener List */
private Vector xxxListeners = new Vector();
public void addActionEventListener(ActionListener listener)
{
xxxListeners.addElement(ActionListener.class);
xxxListeners.addElement(listener);
}
}