在带有不可运行 Jar 的 Eclipse 中使用外部 Jar 依赖项 [英] Using external Jar dependency in Eclipse with Non-Runnable Jar
问题描述
我正在 Eclipse 中制作一个 Jar 文件来运行 Applet,该程序使用了一个外部 jar 文件 (jxl.jar).当我运行小程序时,它告诉我它找不到我正在尝试使用的 jxl 文件.
I am making a Jar file in Eclipse to run an Applet, and the program uses an external jar file (jxl.jar). When I run the applet, it tells me it can't find the jxl files I am trying to use.
当我制作 jar 文件时,我右键单击该项目并选择导出,然后选择 JAR 文件.我在对话框中没有看到包含依赖项的选项.我如何确保它包含我的外部 jar 文件,该文件作为外部 Jar 文件添加到我的项目属性中的外部 Java 构建路径中.
When I make the jar file, I right click the project and select Export and then JAR file. I don't see an option in the dialog that comes up to include dependencies. How can I ensure that it is including my external jar file, which is added to the external Java Build Path as an External Jar file in my Project Properties.
推荐答案
有两种方法可以做到这一点:
There are two ways to do this:
在archive"参数中指定依赖的JAR;例如
Specify the dependent JAR in the "archive" parameter; e.g.
ARCHIVE="myapplet.jar,jxl.jar"
在你的小程序JAR的manifest中指定依赖的JAR;例如在 manifest.mf 文件中添加这一行:
Specify the dependent JAR in the manifest of your applet JAR; e.g. in the manifest.mf file add this line:
Class-Path: jxl.jar
这篇关于在带有不可运行 Jar 的 Eclipse 中使用外部 Jar 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!