How to set Minecraft server port from the CLI?

I can’t seem to find an up-to-date and clear answer on this. I just want to run the Minecraft server JAR on a different port than the default 25565.

  • My village appears to be a ghost town. How do I get my people back?
  • How do I play Minecraft with friends without being connected to the same wifi network?
  • What enchantments can books have?
  • How can I export all item ID's, Metadata and Names?
  • Finding multiple End cities
  • Test if player is holding something but the specified item
  • How can I limit the area in which players spawn?
  • How can Buildings be Made Fireproof?
  • How to test for time of day with command block in Minecraft
  • How to use a command block to welcome new players on a server in Minecraft?
  • End Portal in FTB teleports to random location in the overworld
  • How can I level water?
  • One Solution collect form web for “How to set Minecraft server port from the CLI?”

    You can change the port in the server.properties-file. You can find this file in the same directory as your server.jar is in. Edit this file like this: server-port=<new-port> (e.g. server-port=1337 to run the server on port 1337).

    You can find a detailed documentation about the server.properties-file and the affected property here: http://minecraft.gamepedia.com/Server.properties

    If you really want to change the port from cli you can use Bukkit and pass an argument -p=<new-port> to launch the server on a different port. It also overrides the server-port-property in the server.properties-file. (Source: CraftBukkit Source Code) Example: java -jar bukkit.jar -p=1337.

    Hope it helps. 🙂

    We love Playing Games, especially Video Games.