java - Launch4j - 线程 "main"java.lang.NoClassDefFoundError : javax/mail/MessagingException 中的异常

标签 java installation

我使用 launch4j ( http://launch4j.sourceforge.net/ ) 软件创建了我在 java netbeans 中创建的应用程序的可执行文件。

我按照我在教程中看到的那样做了所有事情,只是当我运行它在我的应用程序中创建的 exectutavel 时,它给出了这个错误:

enter image description here

下面显示的消息是:

 Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
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.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)
    ... 6 more

有谁能帮我解决这个问题

我一直在寻找,但我无法解决。对于这个问题,我深表歉意,但我是 Java 的新手。

谢谢大家

问候

最佳答案

在你的 launch4j 配置文件中添加这样的 jars

<classPath mainClass="your.main.class">
    <cp>path/to/javamail.jar</cp>
    <cp>path/to/folder/*.jar</cp> // you can also add all the jars in a folder like this
</classPath>

它会自动捆绑它们。

希望对你有帮助

编辑

刚刚经历了 netbeans 与 launch4j 的集成,似乎没有办法编写你的配置 xml 文件,而是在 launch4J GUI 中提示你依赖项。我搜索并找到了this Stackoverflow Post .这就是你想要的。祝你好运。

关于java - Launch4j - 线程 "main"java.lang.NoClassDefFoundError : javax/mail/MessagingException 中的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23516137/

相关文章:

java - java中私有(private)方法的重写

java - 如何在等待长 POST 请求时显示进度/请等待类型组件

rust - 如何使用 `cargo` 自定义安装?

c++ - 如何在二进制发行版中提供资源文件的路径?

wix - .NET 中的 Environment.SpecialFolder.ApplicationData 在 WiX 中的等价物是什么?

java - Arraylist 交换元素

java - 如何在 Tomcat 8 中设置 Java 运行时参数

java - 可以在 Java 中强制执行包依赖层次结构吗?

ubuntu - 在 xampp for ubuntu 中安装 YII 框架

qt - 如何配置 qmake 以便我的应用程序安装为 "make install"?