我一直在研究一个使用
Javamail API根据时间事件和某些条件发送电子邮件的程序.该程序在
Eclipse(最新版本)中运行完美,javamail和激活器jar在构建路径中,javamail的依赖项也是如此.当我将项目导出为jar并尝试运行它时,会出现问题. (生成的堆栈跟踪与Eclipse构建路径中缺少javamail jar时的堆栈跟踪相同).
堆栈跟踪如下:
`Exception in thread "Timer-1" java.lang.NoClassDefFoundError: javax/mail/MessagingException at SpaceCheck.HourlySpaceAlerts(SpaceCheck.java:212) at WarningReports.run(WarningReports.java:21) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException 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) ... 4 more`
谢谢您的帮助.