Change Jetty default port

前端 未结 10 1141
野性不改
野性不改 2020-12-29 04:15

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

相关标签:
10条回答
  • 2020-12-29 04:55

    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
    
    0 讨论(0)
  • 2020-12-29 04:58

    I changed the port successfully, you can try to edit jetty.port in the file located at $Jetty_home/start.d/http.ini.

    0 讨论(0)
  • 2020-12-29 05:01

    Just for completeness on jetty 7 you can use this:

    java -jar start.jar --module=http jetty.port=9080
    
    0 讨论(0)
  • 2020-12-29 05:02

    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
    
    0 讨论(0)
  • 2020-12-29 05:03

    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.

    0 讨论(0)
  • 2020-12-29 05:08

    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
    
    0 讨论(0)
提交回复
热议问题