将 jar 文件安装到 Tomcat Web 应用程序
如何将第 3 方 JAR 文件安装到我的 tomcat Web 应用程序?
我已将它放在我能想到的每个文件夹中,并像这样引用它:
import com.google.api.translate;
是否有特定的文件夹?我已经尝试过 WEB_INF/lib
How do I install a 3rd party JAR file to my tomcat web application?
I have placed it in every folder I can think of, and am referencing it like:
import com.google.api.translate;
Is there a particular folder? I have tried WEB_INF/lib
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 Tomcat 上的所有应用程序都需要该 JAR,则如果您使用的是 Tomcat 6.x 或更高版本,则放置该 JAR 的位置为 /lib;如果使用 5.x 或更低版本,则放置该 JAR 的位置为 /server/lib。
如果只有您的应用程序需要第 3 方 JAR,请将其放在 WEB-INF/lib 中。
我希望您将应用程序打包为 WAR 文件。
建议您在继续之前阅读更多有关 Tomcat 和 CLASSPATH 的内容。
对我来说,这看起来不像正确的 Java。难道不应该是:
包含这些类的 JAR 的名称是什么?你在哪里找到的?
看起来您想以某种方式使用 Google 的翻译 API。
If all apps on Tomcat need that JAR, the place to put it would be /lib if you're using Tomcat 6.x or higher and /server/lib if it's version 5.x or lower.
If only your app needs a 3rd party JAR, put it in WEB-INF/lib.
I hope you're packaging your app as a WAR file.
I'd recommend reading a bit more about Tomcat and CLASSPATH before you proceed.
This doesn't look like proper Java to me. Shouldn't that be:
What is the name of the JAR containing those classes? Where did you find it?
Looks like you want to use Google's translate API somehow.