Jetty – How to make sure you are able to start and stop the service on demand

I recently installed Jetty as a service on a Mac and had to go through the painful process of killing the process in-order to stop the server. Typically, we start Jetty just like running any other jar file:

java -jar start.jar

I had the opportunity to go through a few blog posts on best practices and here is what I use now all the time:

Start JETTY:

 

java -DSTOP.PORT=8080 -DSTOP.KEY=stop_jetty_server -jar start.jar

Stop JETTY:

java -DSTOP.PORT=8080 -DSTOP.KEY=stop_jetty_server -jar start.jar --stop

Be First to Comment

Leave a Reply

Your email address will not be published.