Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add jvm options to tomcat on windows 7

Tags:

java

tomcat

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?

like image 850
hellzone Avatar asked Dec 18 '13 12:12

hellzone


People also ask

Where do I put JVM options?

To update JVM options manually for an MSI installation: jvmoptions file. For an MSI distribution the file is located in the %programdata%\JetBrains\YouTrack\conf directory. Edit the JVM options directly in the file.

Does Tomcat have JVM?

Apache Tomcat is a Java servlet container, and is run on a Java Virtual Machine, or JVM. Tomcat utilizes the Java servlet specification to execute servlets generated by requests, often with the help of JSP pages, allowing dynamic content to be generated much more efficiently than with a CGI script.


1 Answers

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.

like image 114
Christopher Schultz Avatar answered Oct 20 '22 00:10

Christopher Schultz