【发布时间】:2023-04-07 09:03:01
【问题描述】:
我在包含一个 JAR 文件时遇到了问题,该文件添加了一个让我的主类发送电子邮件的类。
我做了什么……
- 将 EmailAPI.jar 文件保存在我的文件夹中,如下面的 POM 文本中所述(它找到了它,因为在 NetBeans 中我可以探索该类)
-
更新了我的POM文件中的依赖,如下:
<dependency> <groupId>EmailAPI</groupId> <artifactId>EmailAPI</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}\src\lib\EmailAPI.jar</systemPath> </dependency> -
添加导入(NetBeans 在我使用 Email 类时自动添加了这个,所以它似乎知道在哪里看......)
导入我.nrubin29.emailapi.Email;
-
调用类,直接使用提供的结构
//send an email new Email() .withSMTPServer("smtp.gmail.com") .withUsername("xxxxx@gmail.com") .withPassword("xxxxxxx") .withTo("xxxxx@gmail.com; xxxxx@gmail.com") .withSubject("[RP] Server has started") .withBody("This is the body!") .send();
我可以很好地构建,一切正常...但是当我尝试运行它(作为 Minecraft 的插件)时,我得到一个 NoClassDefFoundError,如下所示: http://pastebin.com/V33gCLVG
我不明白我在这里缺少什么。谁能指出我正确的方向?
【问题讨论】:
标签: java maven netbeans error-handling runtime-error