小弟才學 JavaMail 安書上的例子寫了下面的代碼 編譯通過但是 運行不了 幫忙看看!!!!
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Assimilator{
public static void main(String args[]){
try{
Properties Props=new Properties();
Props.put("mail.host","163.net");
Session mailConnection=Session.getInstance(Props,null);
System.out.println("here");
Message msg=new MimeMessage(mailConnection);
Address bill=new InternetAddress("god@micorosoft.com");
Address elliotte=new InternetAddress("liuxing23@163.net");
msg.setContent("resis is full","text/plain");
msg.setFrom(bill);
msg.setRecipient(Message.RecipientType.TO,elliotte);
msg.setSubject("You Well");
Transport.send(msg);
}catch (Exception e){
e.printStackTrace();
}
}
}
錯誤提示如下:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
at Assimilator.main(Assimilator.java:17)