Hi,
Ich bin ziemlich neu in Java (VB/C für mich) und schreibe gerade einen einfachen EmailClient.
Bekomme dabei aber immer die gleiche meldung (es Kompiliert ohne Fehler msgs aber beim ausführen bekomme ich probleme):
DEBUG: setDebug: JavaMail version1.32
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/act
ivation/DataSource
at Mailer.actionPerformed(Mailer.java:85)
at java.awt.Button.processActionEvent(Button.java:388)
at java.awt.Button.processEvent(Button.java:356)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Component.dispatchEvent(EventQueue.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Sieht so aus also obs was mit der awt zu tun hätte, aber es klappt auch nicht wenn ich's anders versuche.
hier ist ein teil vom code, danke:
Ich bin ziemlich neu in Java (VB/C für mich) und schreibe gerade einen einfachen EmailClient.
Bekomme dabei aber immer die gleiche meldung (es Kompiliert ohne Fehler msgs aber beim ausführen bekomme ich probleme):
DEBUG: setDebug: JavaMail version1.32
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/act
ivation/DataSource
at Mailer.actionPerformed(Mailer.java:85)
at java.awt.Button.processActionEvent(Button.java:388)
at java.awt.Button.processEvent(Button.java:356)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Component.dispatchEvent(EventQueue.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Sieht so aus also obs was mit der awt zu tun hätte, aber es klappt auch nicht wenn ich's anders versuche.
hier ist ein teil vom code, danke:
Code:
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.text.*;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
public class Mailer extends Frame implements ActionListener {
String hostName;
int port = 25;
private Socket smtpSocket = null;
private DataOutputStream os = null;
private DataInputStream is = null;
Button send = new Button("Send");
Button connect = new Button("Connect");
TextField server = new TextField("mail.eircom.net");
TextField to = new TextField("tosomeone@eircom.net");
TextField from = new TextField("fromsomeone@eircom.net");
TextField subject = new TextField("Subject");
TextField body = new TextField("Body");
Mailer (String title){
super(title);
setLayout(null);
server.setBounds(20,90,170,20);
to.setBounds(20,120,170,20);
from.setBounds(20,150,170,20);
subject.setBounds(20,180,170,20);
body.setBounds(20,210,500,200);
connect.setBounds(90,40,70,30);
send.setBounds(20,40,50,30);
add(send);
add(to);
add(from);
add(server);
add(subject);
add(body);
add(connect);
addWindowListener(new WindowHandler());
send.addActionListener(this);
//end GUI. Start mail
}
class WindowHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource()==send)
{
to.setText("IT WORX");
String msg_recip = "setec@eircom.net";
String msg_subject = "test email";
String msg_body = "test";
Message mesg;
Session session;
Properties props = new Properties();
props.put("mail.eircom.net", "www.eircom.net");
session = Session.getDefaultInstance(props, null);
session.setDebug(true);
try {
mesg = new MimeMessage(session);
mesg.setFrom(new InternetAddress("setec@eircom.net"));
InternetAddress toAddress = new InternetAddress(msg_recip);
mesg.addRecipient(Message.RecipientType.TO, toAddress);
.setContent("Hello", "text/plain");
mesg.setSubject(msg_subject);
mesg.setText("Hello");
Transport.send(mesg);
}
catch (MessagingException ex){
while((ex = (MessagingException)ex.getNextException()) != null){
ex.printStackTrace();
}
}
}
}
public static void main(String[] args) {
Mailer window = new Mailer("XMail");
window.pack();
window.setVisible(true);
}
public void send(BufferedReader in, BufferedWriter out, String s) {
try {
out.write(s + "\n");
out.flush();
System.out.println(s);
s = in.readLine();
System.out.println(s);
}
catch (Exception e) {
e.printStackTrace();
}
}
}