[英]java.lang.ClassNotFoundException in runnable jar exported by Eclipse
I am using Eclipse to export my project into a runnable jar. 我正在使用Eclipse将项目导出到可运行的jar中。
I'm using a few libraries, namely Apache commons, Java FX, and GSON. 我正在使用一些库,即Apache Commons,Java FX和GSON。
I have added those libraries to my Build Path inside Eclipse: 我已将这些库添加到Eclipse中的“构建路径”中:
When exporting, I choose to package the required libraries into the generated jar: 导出时,我选择将所需的库打包到生成的jar中: This creates a jar called Editor.jar 这将创建一个名为Editor.jar的jar
However when I do "java -jar Editor.jar" I get the java.lang.ClassNotFoundException for the class EqualsBuilder which is a part of Apache commons. 但是,当我执行“ java -jar Editor.jar”时,我得到类EqualsBuilder的java.lang.ClassNotFoundException,该类是Apache Commons的一部分。
I've tried copying the apache commons-lang3-3.4.jar file into the working directory. 我试图将apache commons-lang3-3.4.jar文件复制到工作目录中。 I've also tried adding "-cp commons-lang3-3.4.jar" before the "-jar". 我也尝试在“ -jar”之前添加“ -cp commons-lang3-3.4.jar”。 Still I always get the ClassNotFoundException. 仍然我总是得到ClassNotFoundException。
Does anyone see what I'm missing? 有人看到我想念的东西吗? Thanks. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.