我写了一个JAVA发送邮件的例子,但是怎么样都运行不了
已经把activation.jar,mail.jar加入到该工程lib文件夹下面,jdk的lib下面也加了,然后这是classpath的配置C:\ProgramFiles...
已经把activation.jar,mail.jar加入到该工程lib文件夹下面,jdk的lib下面也加了,然后这是classpath的配置
C:\Program Files\Java\jdk1.5.0\lib\servlet-api.jar;C:\Program Files\Java\jdk1.5.0\lib\tools.jar;C:\Program Files\Java\jdk1.5.0\lib\dt.jar;C:\Program Files\Java\jdk1.5.0\lib\activation.jar;C:\Program Files\Java\jdk1.5.0\lib\mail.jar;
然后依旧是报出
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
at javax.mail.Session.loadProvidersFromStream(Session.java:928)
at javax.mail.Session.access$000(Session.java:174)
at javax.mail.Session$1.load(Session.java:870)
at javax.mail.Session.loadResource(Session.java:1084)
at javax.mail.Session.loadProviders(Session.java:889)
at javax.mail.Session.<init>(Session.java:210)
at javax.mail.Session.getInstance(Session.java:232)
at com.Yz.emailMaker.EmailSender.send(EmailSender.java:47)
at com.Yz.emailMaker.EmailSender.main(EmailSender.java:77)
是不是还和tomcat的设置有关系?
复制了,还是报这个错 展开
C:\Program Files\Java\jdk1.5.0\lib\servlet-api.jar;C:\Program Files\Java\jdk1.5.0\lib\tools.jar;C:\Program Files\Java\jdk1.5.0\lib\dt.jar;C:\Program Files\Java\jdk1.5.0\lib\activation.jar;C:\Program Files\Java\jdk1.5.0\lib\mail.jar;
然后依旧是报出
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream
at javax.mail.Session.loadProvidersFromStream(Session.java:928)
at javax.mail.Session.access$000(Session.java:174)
at javax.mail.Session$1.load(Session.java:870)
at javax.mail.Session.loadResource(Session.java:1084)
at javax.mail.Session.loadProviders(Session.java:889)
at javax.mail.Session.<init>(Session.java:210)
at javax.mail.Session.getInstance(Session.java:232)
at com.Yz.emailMaker.EmailSender.send(EmailSender.java:47)
at com.Yz.emailMaker.EmailSender.main(EmailSender.java:77)
是不是还和tomcat的设置有关系?
复制了,还是报这个错 展开
3个回答
展开全部
放到tomcat\common\lib下面
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
加载包不对
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询