Using external Jar dependency in Eclipse with Non-Runnable Jar

会有一股神秘感。 提交于 2019-12-12 02:34:46

问题


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.

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.


回答1:


There are two ways to do this:

  • Specify the dependent JAR in the "archive" parameter; e.g.

    ARCHIVE="myapplet.jar,jxl.jar"
    
  • 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
    


来源:https://stackoverflow.com/questions/10060520/using-external-jar-dependency-in-eclipse-with-non-runnable-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!