Search code examples
linuxspring-boottomcat7

Running Spring Boot application in embedded Tomcat server in Linux


I am running Spring Boot application in embedded Tomcat server. I am placing the executable jar file with Tomcat server embedded in it in a path in Linux server, logging in to Linux environment using putty, navigating to the path where I have kept my jar file and running as

java -jar my-jar.jar

The problem is using this way the embedded tomcat server will stop and the jar file will stop running when putty is exited. Can you suggest a way how to execute the executable jar file so that it keeps running in the Linux environment without stopping.

One solution I found is to run the jar as a service of Linux. Is there any other way of doing this?


Solution

  • You can start it as background process:

    java -jar my-jar.jar &
    

    But the Linux service is the better way.