当前位置: 代码迷 >> Eclipse >> java邮件有关问题异常提示Exception in thread "main" java.lang.NoClassDefFoundError: javax/,郁闷
  详细解决方案

java邮件有关问题异常提示Exception in thread "main" java.lang.NoClassDefFoundError: javax/,郁闷

热度:16   发布时间:2016-04-23 14:00:08.0
java邮件问题错误提示Exception in thread "main" java.lang.NoClassDefFoundError: javax/,郁闷
package cn.itcast.javamail;

import javax.mail.Message;
import java.util.Properties;

import javax.mail.Address;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Demo1Bean {

/**
* @param args
*/
public static void main(String[] args) throws Exception {

Properties props = new Properties();
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
Session session = Session.getInstance(props);
session.setDebug(true);

Message msg = new MimeMessage(session);
msg.setText("hello, world");
msg.setFrom(new InternetAddress ("lidonghaihome@163.com"));

Transport transport = session.getTransport();
transport.connect("smtp.163.com", 25 , "lidonghaihome","19841022");
transport.sendMessage(msg, new Address[]{new InternetAddress ("lidonghaihome@163.com")});
transport.close();



}

}


错误提示
DEBUG: setDebug: JavaMail version 1.4ea
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
at cn.itcast.javamail.Demo1Bean.main(Demo1Bean.java:24)


------解决方案--------------------
怎么弄好的,分享分享
  相关解决方案