加入第三方图书馆的Java Applet [英] Adding a Third Party Library to Java Applet
问题描述
我有一个Java小程序,需要一个第三方库,但我怎么罐子添加到类路径,并参考了Java小程序?
I have a Java Applet that needs a 3rd party library, but how do I add the jar to the classpath and reference it to the Java Applet?
我的第三方库是org.apache.commons.lang.StringUtils
My third party library is org.apache.commons.lang.StringUtils
推荐答案
把其他的罐子在类路径
属性在MANIFEST.MF和
建立一个索引到其他JAR,这样加载器将不必下载
一个罐子,除非它真的需要它。
Put the other jars in the Class-Path
property in the manifest.mf and
build an index to the other jars so that the loader won't have to download
a jar unless it really needs it.
另外,你可以提归档变量的罐子。
在归档变量您可以添加多个罐子:归档=MyJar.jar,JarFile1.jar,JarFile2.jar
Alternatively, you can mention the jars in the archive tag.
In archive tag you can add multiple jars: archive="MyJar.jar,JarFile1.jar,JarFile2.jar"
所以,你的存档属性会是这样归档=YourProject.jar,公地郎2.1.jar
(请记住,你必须把公地朗与YourProject.jar 2.1.jar在你的服务器上的同一目录。)
So your archive attribute will be like this archive="YourProject.jar,commons-lang-2.1.jar"
(Remember that you have to put commons-lang-2.1.jar with YourProject.jar in the same dir on your server.)
这篇关于加入第三方图书馆的Java Applet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!