YLombardi YLombardi - 4 years ago 182
Linux Question

Spring boot application as a service + VM Options

I have a Spring boot application that is started as a service using Linux's systemd.

It is based on this documentation :

With the default script, the jar file start. It works fine.

/etc/systemd/system/myapp.service :




Now I want to add VM Option when the jar start.
I tried to add a .conf file to the project but it doesn't work.

/var/myapp/myapp.conf :

JAVA_OPTS=-Xms256M -Xmx512M

How can I add JVM option to start the application with systemd ?

Answer Source

I finally found a solution here : how to configure heap size when start a spring-boot application with embedded tomcat?

The content of my .conf file was wrong. I need too write this :

export JAVA_OPTS="-Xms256m -Xmx512m"

Now when I run "service myapp start", it start with the good heap size.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download