Tomcat 8 configure jvm memory

Posted April 11, 2018 18.5k views
ApacheJavaApplicationsUbuntu 16.04

Hi all,

I am having trouble increasing the memory of my jvm tomcat 8. my droplet ubuntu 16.04 has 1 gb of memory.

I configured the within the path opt/tomcat/conf file like this:

export CATALINA_OPTS = "$CATALINA_OPTS -XX:MaxPermSize=256M"

When starting tomcat the following error is displayed.

Invalid initial heap size: -Xms256M
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit

I would like some help??

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Doing some digging on this I’ve found a few suggestions on how to either adjust the lines you’ve shared or set these defaults for Java globally.

Following the examples here should help you to resolve this issue.

  • I made the change as stated in the stack …

    export CATALINA_OPTS = "- Xms256M -Xmx512M"

    when performing the restart of tomcat presented:

    Invalid maximum heap size: -Xmx256M
    Error: Could not create the Java virtual Machine

    I think that the tomcat8 configuration is otherwise. I looked at several forums and found nothing that works

I followed the guideline at
It is saying about creating a tomcat service, memory can be set out there:

sudo nano /etc/systemd/system/tomcat.service
Environment=‘CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC’

by Justin Ellingwood
Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation...