How to add JVM options in tomcat as window service

Solution Verified - Updated -

Issue

  • After editing C:\jws-3.0\share\apache-tomcat-7.0.59\bin\service.bat like below, tomcat server could start well but did not log GC details except first line.

[service.bat]

...
"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-XX:+PrintGCDetails;-XX:+PrintGCTimeStamps;-XX:+PrintHeapAtGC;-Xloggc:C:/jws-3.0/logs/gc.log" --JvmMs 256 --JvmMx 512
...
C:\jws-3.0\bin> service.bat install
Installing the service 'Tomcat7' ...
Using CATALINA_HOME:    "C:/jws-3.0"
Using CATALINA_BASE:    "C:/jws-3.0"
Using JAVA_HOME:        "C:\Java\1.7.0_79"
Using JRE_HOME:         "C:\Java\1.7.0_79\jre"
Using JVM:              "C:\Java\1.7.0_79\jre\bin\server\jvm.dll"
The service 'Tomcat7' has been installed.

[gc.log]

Java HotSpot(TM) 64-Bit Server VM (24.79-b02) for windows-amd64 JRE (1.7.0_79-b15), built on Apr 10 2015 12:36:16 by "java_re" with unknown MS VC++:1600
Memory: 4k page, physical 3145272k(2074968k free), swap 6288688k(4927700k free)
CommandLine flags: -XX:InitialHeapSize=268435456 -XX:MaxHeapSize=536870912 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC

Environment

  • Red Hat JBoss Web Server 3.X on Windows

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content