Direct answer
Stop the server, change server-port in server.properties, then start the server again. If the server is reachable from the internet, update the firewall and router forwarding rule to match the new port.
Change the property
server-port=25566Use a valid unused port. The normal Java server port is 25565, so most players do not have to type it explicitly when you keep the default.
How players connect to a custom port
example.com:25566or:
203.0.113.10:25566The example IP above is documentation-only; use your real reachable address.
Update every layer
server.propertieslistening port.- Windows/Linux host firewall rule.
- Router port-forward rule for a home-hosted server.
- Hosting-panel allocation, if the host assigns specific ports.
- Any DNS SRV record or proxy configuration that points at the old port.
Why a second server needs another port
Two server processes cannot normally listen on the same IP and port at the same time. If you run multiple direct Java servers on one machine, assign each a unique port or put them behind an appropriate proxy architecture.
Official references
These references were checked while preparing this guide. Version-specific behavior can change, so use the project documentation for your exact release when a detail differs.
Related guides
Help us improve this article
Tell us what is missing, unclear, outdated, or incorrect. You can also suggest something we should add.