How to add jvm options to tomcat on windows 7

前端 未结 3 1758
心在旅途
心在旅途 2021-02-10 07:59

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

3条回答
  •  长发绾君心
    2021-02-10 08:52

    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.

    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.

    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.

提交回复
热议问题