使用 CATALINA_OPTS 添加到 Tomcat 类路径
我正在尝试将 jar 文件的目录(或者单独的每个 jar 文件)添加到 tomcat 实例的类路径中。困难在于我实际上无法针对这个特定问题修改 /conf/catalina.properties 文件。我可以设置 CATALINA_OPTS 变量,即:
导出CATALINA_OPTS = "$CATALINA_OPTS -classpath /path/to/lib/file.jar"
但是,这似乎没有将 jar 文件添加到类路径中。
是否可以像这样修改 Tomcat 类路径?我知道 CLASSPATH 变量不是'根本没用过。
I'm trying add a directory of jar files (or barring that, each jar file individually) to the classpath for a tomcat instance. The difficulty is that I can't actually modify the /conf/catalina.properties file for this particular problem. I can set the CATALINA_OPTS variable, ie:
export CATALINA_OPTS = "$CATALINA_OPTS
-classpath /path/to/lib/file.jar"
However, this does not seem to add the jar file to the classpath.
Is it even possible to modify the Tomcat classpath like this? I'm aware that the CLASSPATH variable isn't used at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将 jar 文件放入
它们将从那里加载。
You can place your jar files in
They will be loaded from there.
查看运行 Tomcat 的脚本。在运行 java 进程之前打印类路径。据我记得它在编写命令行时使用变量 CLASSPATH 。
Take a look on script that runs your tomcat. Print classpath just before it runs java process. As far as I remember it is using variable CLASSPATH when composing the command line.
Tomcat 有一个扩展文件夹,旨在包含这些类型的 jar。如果我没记错的话,只需将 jar 复制到此文件夹即可。
Tomcat has an extension folder, designed to contain these kinds of jars. If I recall correctly it is just a matter of copying your jars to this folder.