Jetty default port is 8080, but I want to change to default port to some other port (9999).
I read a few tutorials and they said almost all of configuration informa
For IntelliJ, this can be done similar to Magnus Lassi's command-line answer.
Run --> Edit Configurations --> Add "-Djetty.port=XXXX", e.g.:
jetty:run-war -Djetty.port=9999
I changed the port successfully, you can try to edit jetty.port
in the file located at $Jetty_home/start.d/http.ini
.
Just for completeness on jetty 7 you can use this:
java -jar start.jar --module=http jetty.port=9080
You need to change the http port in the start.ini file because it will over-right jetty-http.xml config.Or just comment the line in start.ini and keep your config from jetty-http.xml. In [jetty home]/start.ini
## HTTP port to listen on
#jetty.port=8080
If you are using eclipse you need to set the run configurations. When you install jetty in eclipse, the default port for jetty is 8080.
So you need to change it into an XML file. If the problem remains, you need to change it in eclipse run configurations.
I hope it works, as it worked for me.
Update:
On Jetty 9.x, jetty.port
has been deprecated and you can use jetty.http.port
instead, as shown below:
$> cd $JETTY_HOME && java -jar start.jar -Djetty.http.port=8080