[英]How to export an Eclipse Project with External Jar dependencies?
In Processing, I'd like to import a library I've written in Java which wraps around an external library (a .jar file). 在处理中,我想导入一个用Java写的库,该库环绕一个外部库(一个.jar文件)。
Processing appears to import my own library, but when I call the constructor (which references some classes in the external library), I get a java.lang.NoClassDefFoundError
in the Processing GUI console. 处理似乎是导入我自己的库,但是当我调用构造函数(它引用外部库中的某些类)时,在处理GUI控制台中得到了
java.lang.NoClassDefFoundError
。
If instead of including the External .jar in my Eclipse buildpath, I use the library's actual source code and export all of that, Processing does not complain. 如果不是在我的Eclipse构建路径中包括External .jar,而是使用该库的实际源代码并将其全部导出,那么Processing不会抱怨。
How might I be able to package up this project so that I don't have to include all of the library's source code (and instead just include the .jar file) in my Eclipse project? 我如何能够打包该项目,以使我不必在Eclipse项目中包括库的所有源代码(而只需包括.jar文件)?
Update : As per NLtelaviv 's suggestion, I chose to export as a Runnable JAR. 更新 :根据NLtelaviv的建议,我选择导出为Runnable JAR。 What worked for me was to select the option "Copy required libraries into a sub-folder next to the generated JAR."
对我有用的是选择选项“将所需的库复制到生成的JAR旁边的子文件夹中”。 Here, another folder is created next to where your .jar is output containing the referenced .jar libraries.
在这里,将在输出包含所引用的.jar库的.jar的旁边创建另一个文件夹。
Update2 : The other option which works is "Extract required libraries into generated JAR." Update2 :另一个可行的选择是“将所需的库提取到生成的JAR中”。 Doing so allows the JAR to access the references internally.
这样做允许JAR在内部访问引用。 It seemed as though the same would have worked with NLtelaviv 's suggestion, but that does not appear to be the case.
NLtelaviv的建议似乎同样可行,但事实并非如此。 Choose this option if you don't want to have any extra files.
如果您不想有任何其他文件,请选择此选项。 You'll notice, if you explore the .JAR file, that the external library is in a separate package folder.
如果浏览.JAR文件,您会注意到,外部库位于单独的包文件夹中。
Use the Runnable JAR file export option. 使用可运行的JAR文件导出选项。
Click on your project - export - java- runnable jar file - select the option to pack requires libraries in the jar 单击您的项目-导出-Java-可运行的jar文件-选择将所需库打包的选项
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.