向 Java Applet 添加第三方库 [英] Adding a Third Party Library to Java Applet

查看:33
本文介绍了向 Java Applet 添加第三方库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要第 3 方库的 Java Applet,但如何将 jar 添加到类路径并将其引用到 Java Applet?

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

推荐答案

将其他 jars 放在 manifest.mf 的 Class-Path 属性中并为其他 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.

或者,您可以在存档标签中提及 jar.在存档标签中,您可以添加多个 jar:archive="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"

所以你的存档属性会是这样的 archive="YourProject.jar,commons-lang-2.1.jar" (记住你必须把 commons-lang-2.1.jar 和 YourProject.jar 放在一起.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆