如何在 Windows 7 上向 tomcat 添加 jvm 选项 [英] How to add jvm options to tomcat on windows 7

查看:17
本文介绍了如何在 Windows 7 上向 tomcat 添加 jvm 选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Windows 7 上向 Tomcat 添加 jvm 选项?.顺便说一下,我使用的是 Tomcat 7.我将 jvm 选项添加到了 catalina.bat 文件的第一行,但是没有用.我想我做错了什么.有什么想法吗?

How can I add jvm options to Tomcat on Windows 7?. By the way I am using Tomcat 7. I added my jvm options to first line of catalina.bat file but it didn't work. I think I am doing something wrong. Is there any idea?

推荐答案

创建文件 bin/setenv.bat.如果您使用 bin/startup.batbin/catalina.bat 来启动 Tomcat,那么 setenv 脚本将在执行大多数其他操作.您可以通过设置 CATALINA_OPTS 环境变量来设置您想要的任何 JVM 选项.

Create the file bin/setenv.bat. If you are using bin/startup.bat or bin/catalina.bat to start Tomcat, then the setenv script will be run before performing most other operations. You can set whatever JVM options you want by setting the CATALINA_OPTS environment variable.

如果您使用 Microsoft Windows 服务面板中的 Tomcat 服务启动器来启动 Tomcat,则您不能使用此技术.相反,您需要使用适当的 您可以在此处找到的选项.

If you are using Tomcat's service launcher from Microsoft Windows' services panel to launch Tomcat then you cannot use this technique. Instead, you'll need to run tomcat7.exe with the appropriate options you can find here.

请注意,您也可以设置 JAVA_OPTS,但 JAVA_OPTS 将用于所有 JVM 进程,包括启动请求关闭 Tomcat 的进程.例如,如果你想为Tomcat启用RMI服务,并且在JAVA_HOME中设置,那么Tomcat会正常启动,但是当尝试关闭时,由于端口冲突,关闭过程可能会失败.同样,如果您需要 20GiB 的 Tomcat 堆,并且您在 JAVA_OPTS 中设置了 -Xms-Xmx,您最终将创建一个 20GiB停止 Tomcat 进程的堆.因此,除非您有充分的理由使用 JAVA_OPTS,否则请使用 CATALINA_OPTS.

Note that you can also set JAVA_OPTS but JAVA_OPTS will be used for all JVM processes, including the one launched to request a shutdown of Tomcat. For example, if you want to enable RMI services for Tomcat and you set them in JAVA_HOME, then Tomcat will start up properly but when attempting to shutdown, the shutdown process may fail due to port conflicts. Similarly, if you need a 20GiB heap for Tomcat and you set -Xms and -Xmx in JAVA_OPTS, you'll end up creating a 20GiB heap for the process that stops Tomcat. So, use CATALINA_OPTS unless you have a very good reason to use JAVA_OPTS.

这篇关于如何在 Windows 7 上向 tomcat 添加 jvm 选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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