作了一个邮件程序如下:import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.internet.MimeMessage;
public class mail{
public static void main(String[] args) throws Exception {
Properties props=new Properties();
props.put("mail.smtp.host","192.168.42.253");
Session session=Session.getDefaultInstance(props,null);
Message msg=new MimeMessage(session);
InternetAddress addressFrom=new InternetAddress("[email protected]");
msg.setFrom(addressFrom);
InternetAddress addressTo=new InternetAddress("[email protected]");
msg.setRecipient(Message.RecipientType.TO,addressTo);
msg.setSubject("text");
msg.setContent("text one","text/plain");
Transport transport=session.getTransport("smtp");
transport.send(msg);
}
}能通过编译,但运行时提示:Exception in thread "main" java.lang.NoClassDefFoundError:javax/activation/Data
Source
at mail.main<mail.java:13>
请问如何解决阿?
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.internet.MimeMessage;
public class mail{
public static void main(String[] args) throws Exception {
Properties props=new Properties();
props.put("mail.smtp.host","192.168.42.253");
Session session=Session.getDefaultInstance(props,null);
Message msg=new MimeMessage(session);
InternetAddress addressFrom=new InternetAddress("[email protected]");
msg.setFrom(addressFrom);
InternetAddress addressTo=new InternetAddress("[email protected]");
msg.setRecipient(Message.RecipientType.TO,addressTo);
msg.setSubject("text");
msg.setContent("text one","text/plain");
Transport transport=session.getTransport("smtp");
transport.send(msg);
}
}能通过编译,但运行时提示:Exception in thread "main" java.lang.NoClassDefFoundError:javax/activation/Data
Source
at mail.main<mail.java:13>
请问如何解决阿?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货