Rick Dellman Rick Dellman - 1 year ago 236
Java Question

Change Java spark port number

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.

Answer Source

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


// Routes of your endpoint...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download