JAVA: MAIL: How can i solve ClassNotFoundException : javax.mail.internet.AddressException?

安稳与你 提交于 2021-02-05 11:21:13

问题


I have some code to send an Email, It works perfectly in my system. But the problem is I copied this program to another system and which gives the following error on runtime.

ClassNotFoundException : javax.mail.internet.AddressException

Note: Both System are Windows 7

Error

Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException:javax.mail.internet.AddressException

    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 6 more   

回答1:


It seems that your dependency jar file are not download or it has some conflict with your dependency.

javax.mail.internet.AddressException locate in the javax.mail-1.4.x.jar.

Can you post your library list or your dependency?



来源:https://stackoverflow.com/questions/28359305/java-mail-how-can-i-solve-classnotfoundexception-javax-mail-internet-address

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!