如何将库附加到JAR文件? [英] How to attach libraries to JAR file?
问题描述
在编译项目时工作正常,但在导出到可运行的 jar
并启动后,它找不到外部文件并发出错误。我应该怎么做?
你可以尝试构建一个 fat jar
包括所有的罐子。它包含一个自定义类加载器,用于加载由项目外部引用的jar。
尝试使用 http://fjep.sourceforge.net/ 插件来构建一个胖子。
您可以导出包含jar的java项目使用文件 - >导出 - >其他 - >一个JAR出口商
。
由此导出的jar工作正常。
It works fine when compiling project, but after exporting it to a runnable jar
and launching, it can't find external files and throws an error. What should I do?
You could attempt building a fat jar
that includes all the jars. It contains a custom class loader to load the jars referenced externally by your project.
Try using http://fjep.sourceforge.net/ plugin to build a fat jar.
You can export a java project containing jars using the File -> Export -> Other -> One Jar Exporter
.
The jar thus exported works fine.
这篇关于如何将库附加到JAR文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!