Change Java spark port number
Asked Answered
S

1

9

My java spark web application using the embedded jetty web server uses port number 4567. Unfortunately this port number is blocked on my computer and don't wish to unblock it. If looked at the spark documentation but it doesn't contain how to change the port number of the embedded Jetty server to 8080.

Salta answered 31/8, 2016 at 23:27 Comment(3)
sparkjava.com/documentation.html#portTip
This might be a dupe. Have you checked this question: https://mcmap.net/q/479393/-change-jetty-default-portAesir
Possible duplicate of How do I change the spark.ui.port?Navarrete
E
14

You can set the port number in your java spark web application using the function port(). This has to be done before using routes and filters

official documentation link: http://sparkjava.com/documentation.html#port

Example

port(8080);
// Routes of your endpoint...
Eberle answered 31/8, 2016 at 23:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.