Jetty – Stop a Jetty Server by Command

To start a Jetty Server, you can type the following command.

java -jar start.jar

 

The only way to stop the Jetty Server is by pressing Ctrl + C in the shell prompt.

Actually, there is a way to issue a stop command to the Jetty Server on another shell prompt. But you have to specify the STOP.PORT and STOP.KEY in the start command as follow.

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

 

After the Jetty Server is started, you can open another shell prompt and stop the Jetty by

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

 

Done =)

14 thoughts on “Jetty – Stop a Jetty Server by Command”

  1. hi I have doubt like the DSTOP port number should be different than port number on which jetty server is running like we give same port number on which the jetty server is running in DSTOP argument . It throws error port number is already in use

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.