在 Tomcat 6 中添加 java_opts 参数
我需要在 Tomcat 中添加 -DAPP_ENCRYPTION_PASSWORD 来启动应用程序。 任何人都可以准确指出在哪里添加此参数吗?又如何呢?
I have a requirement to add -DAPP_ENCRYPTION_PASSWORD in Tomcat to start an application.
Can any one point exactly where to add this parameter? And how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为 Tomcat 设置环境变量的简单且首选的方法是通过 bin/setenv.sh 脚本。请参阅:如何不使用配置程序来调整 Tomcat 5.5 JVM 内存设置
或者这样:https://stackoverflow.com/search?q=setenv.sh
The simple and preferred way to set environment variables for Tomcat is via the
bin/setenv.sh
script. See this: How to tune Tomcat 5.5 JVM Memory settings without using the configuration programOr this: https://stackoverflow.com/search?q=setenv.sh
这完全取决于您计划如何启动 Tomcat。 Tomcat 本身希望运行一个 shell 脚本,该脚本通常位于 $TOMCAT_HOME/bin/catalina.sh(Windows 上有一个等效的 .bat 文件)。该文件内部描述了 tomcat 对环境的期望。如果您想将 -DAPP_ENCRYPTION_PASSWORD 系统属性添加到 Tomcat 的启动中,我想您只需弄清楚如何将其在环境中设置为 JAVA_OPTS 即可。
如果你绝望并且想避免设置环境,我想你可以直接编辑catalina.sh。
环境变量序列看起来像...
从命令 shell部署
”会看起来像...
It all depends on how you plan to start Tomcat. Tomcat itself wants to be run a shell script that's typically located at $TOMCAT_HOME/bin/catalina.sh (there's an equivalent .bat file for windows). Inside of that file it describes what tomcat expects for an environment. If you want to get your -DAPP_ENCRYPTION_PASSWORD system property into the startup of Tomcat, I think you just figure out how to get it set up in the environment as JAVA_OPTS and you are on your way.
If you are desperate and want to avoid setting up the environment, I suppose that you could edit catalina.sh directly.
The environment variable sequence looks like...
is deployed
The output will look like...