在Eclipse中使用外部Jar依赖与Non-Runnable Jar [英] Using external Jar dependency in Eclipse with Non-Runnable Jar
问题描述
我在Eclipse中创建一个Jar文件来运行Applet,程序使用外部jar文件(jxl.jar)。当我运行applet时,它告诉我它找不到我想要使用的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文件时,我右键单击该项目并选择Export,然后选择JAR文件。我没有在对话框中看到包含依赖项的选项。如何确保它包含我的外部jar文件,该文件作为外部Jar文件添加到我的项目属性中作为外部Jar文件。
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"
在applet JAR的清单中指定依赖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
这篇关于在Eclipse中使用外部Jar依赖与Non-Runnable Jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!