将 jar 文件安装到 Tomcat Web 应用程序

发布于 2024-09-26 05:53:24 字数 175 浏览 3 评论 0原文

如何将第 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半岛未凉 2024-10-03 05:53:24

如果 Tomcat 上的所有应用程序都需要该 JAR,则如果您使用的是 Tomcat 6.x 或更高版本,则放置该 JAR 的位置为 /lib;如果使用 5.x 或更低版本,则放置该 JAR 的位置为 /server/lib。

如果只有您的应用程序需要第 3 方 JAR,请将其放在 WEB-INF/lib 中。

我希望您将应用程序打包为 WAR 文件。

我已将它放在我能想到的每个文件夹中

建议您在继续之前阅读更多有关 Tomcat 和 CLASSPATH 的内容。

import com.google.api.translate;

对我来说,这看起来不像正确的 Java。难道不应该是:

import com.google.api.translate.*;

包含这些类的 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 have placed it in every folder I can think of

I'd recommend reading a bit more about Tomcat and CLASSPATH before you proceed.

import com.google.api.translate;

This doesn't look like proper Java to me. Shouldn't that be:

import com.google.api.translate.*;

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文