Tutorials/Setting up a server

This tutorial takes you through the steps of setting up your own server using the default server software that Mojang distributes free of charge. The software may be installed on most operating systems, including Windows, Mac and Linux.

Regardless of your operating system, you must begin by downloading the server software from http://minecraft.net/download. It is recommended that you create a dedicated folder for the server files. (Ensure the filename is precisely minecraft_server.jar or minecraft_server.exe, in case your browser has renamed it to something else.)

Note: There is also custom server software available, but these applications are not officially supported by Mojang.

Warning
Since you're about to run your own server, you should be aware of the possible dangers. Although we can not prevent people from running their server and putting themselves at risk, we may at least appeal that you don't do it when having no idea what you actually do. Running by the instructions below should not put you at any risk, but since this is a wiki which everybody is allowed to edit, and we don't know about your system configuration, we cannot guarantee you'll be out of danger. In order to run your server and stay out of trouble, we strongly recommend you should at least know about the following: If you decide it's too risky, you're welcome to join other servers that fit your taste. A bunch of lists are available here.
 * Networking in general (IP, DHCP, ports etc.)
 * Your system configuration
 * Your network configuration
 * Your router configuration (if you want other people to connect over Internet)
 * How to use and configure your personal firewall (shutting it down is NOT an option!)

REQUIRED: Verify and install the latest version of Java

 * 1) Make sure that you have Java 7 installed. To do so, we first need to open up a command (CMD) window.
 * 2) In Windows 7/Vista/XP hold the Windows key down and press R to open the Run command and type cmd.
 * 3) * At the command prompt, enter the following command, and press enter:
 * 4) * Java then should display its version, which should read "Java version 1.7"
 * 5) If you get this error, " ", then you may have a previous version (less than 1.6) of Java or Java may not be in your system path.
 * 6) *For 32-bit users you can obtain the latest version here: Java download page. If you use a 64-bit OS ensure you download the Windows x64 package.
 * 7) * After you have installed the latest version of Java try again with.
 * If you get an error at this point, try the following to add Java to your system path.
 * 1) *# Right click Computer.
 * 2) *# Click properties.
 * 3) *# Click "Advanced system settings".
 * 4) *# Click "Environment Variables".
 * 5) *# Under system variables, find the Path variable.
 * 6) *# Click edit, and append to the end of the value: . If you use 32-bit Java on a 64-bit OS use:
 * 7) *# Restart your computer.
 * 8) *# Now re-open the command prompt and try again.

Start the Minecraft server (.exe version)

 * 1) Double click on the "Minecraft_Server.exe" file you downloaded and the server should start with a default configuration.
 * 2) Upon its initial start, it may throw some "file not found" error messages. This is normal. The files are being created.
 * 3) After the first start, you'll probably want to shut it down (enter  in the server command window) and then edit some configuration files—as is explained below.

If you get an error like "Can't save server.properties" and your screen fills with useless, gibberish text, close the command prompt window and running the MinecraftServer.bat file as the Administrator by right-mouse clicking on it and choosing 'Run as...'. (You will need the administrator password to do this...)

Start the Minecraft server (.jar version)

 * 1) If you have the .jar version, you will need to have a path variable set up for Java in order to start the jar version of the server. Refer to step 3 of "REQUIRED: Verify and Install the Latest Version of Java" above to set up a path variable.
 * 2) To start the jar version of Minecraft on Windows, create a new file in Notepad, and paste in
 * 3) Save the file as startserver.bat, and place the file in the same folder as minecraft_server.jar. The .bat extension saves the file as a batch file.
 * 4) Double click startserver.bat, and the Minecraft server will run.
 * 1) Double click startserver.bat, and the Minecraft server will run.

Starting the jar version without altering your system path
To start minecraft.jar server without having to change your system path variable you need to instead express the path variable for Java in the "start.bat" file. This is handy because it allows you to still run commands from command prompt using the default system path, without having to constantly edit the system path.
 * 1) To do this open your start.bat file (or whatever you've named it) with Notepad
 * 2) On the very first line add the command  so that a command window isn't opened to show the output from our start file
 * 3) On the next line, make sure the system can find Java (also called the Java Runtime Environment or JRE) by adding it to the Path Environment Variable. On a current Windows PC Java will be most commonly located at "C:\Program Files (x86)\Java\jre7\bin\java.exe", so what you would then write is  where   contains the existing Path values and   contains the location of your 32bit Program Files - usually "C:\Program Files (x86)" (adjust this if you are using Java 6)
 * 4) Finally, make sure on the last line you have the command that starts the Minecraft server itself:
 * 5) If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option  to the end of the last command above, so that it reads:

Here is an example of a bat file that starts the minecraft server on Windows, in this example the minecraft directory is located at D:\minecraft (so minecraft_server.jar is located at D:\minecraft\minecraft_server.jar), the operating system is Windows 7 64 bit, Sun's java.exe is installed at C:\Program Files\Java\jre7\bin   This java happens to be 64 bit and the PC I'm running has plenty of RAM, 16 GB in my case, so I can allocate the 2GB via the   of maximum memory to run minecraft. The  line below tells the bat file to go the D: drive. Also note the double quotes around "Program Files" below, needed because of the space between the words  and. I also chose not to use the @echo off. The  in the 1st line is to just have the MS DOS window that is used to run minecraft display "run-minecraft" in the window title bar.

Increasing the amount of RAM allocated to the Minecraft server
If you would like to start your server with more RAM, you will need to create a Windows batch file and run your server that way. Don't worry, it's easier than it sounds.


 * 1) Open up Notepad (not Wordpad) to create a text document with no formatting (italics, boldface, etc.).
 * 2) Identify your Windows OS type (32-bit or 64-bit), which may be done through the Control Panel. Also, identify which version of Java you are running—32 bit or 64 bit.
 * 3) Based on your OS and Java types...
 * 4) If Windows is 32-bit or Windows is 64-bit with 64-bit Java, copy this into your document (on a single line and remember to include both the " in sentence) (adjust the following line if still using Java 6):
 * 5) If you are, for some reason, running 32-bit Java on a 64-bit system, upgrade Java. Also, if you have installed Java to a different directory or changed the name of your Minecraft server .exe file, see below.
 * 6) If you do have 32-bit Java on a 64-bit system, Java.com recognizes Java by browser, and some browsers are 32-bit, so downloading both 32-bit Java and 64-bit Java may be needed to run everything correctly
 * 7) *So what does all of this mean? The executable command is the file path to the location of your most current javaw.exe file. javaw.exe is identical to java.exe but there is no associated console window, Since we are starting our own from our .bat. If you installed Java to a different location, you will have to locate it and paste that file path in instead. The next part  is your RAM allocation, in megabytes (MB). By default, your server runs with about 100 MB of RAM, which is very little. Most people will change their server to run on  1 GB (1024 MB) of RAM; 2 GB of RAM is also common. As for the , this indicates that Minecraft_Server.exe is a Java archive.
 * 8) *Lastly in the executable command is the name of our .exe file . Typically, it is named Minecraft_Server.exe. Upper and lower case does matter. Rename  to whatever you named your file. Then click   and for the file name call it , and make sure you select   from the drop-down arrow (Note: If you do not see   as a file type, you must put   in quotes.  ). Then save it in the same location your server is saved, and double click your   file. If all goes well, you will notice that you will have much more RAM available on your server!
 * 1) *Lastly in the executable command is the name of our .exe file . Typically, it is named Minecraft_Server.exe. Upper and lower case does matter. Rename  to whatever you named your file. Then click   and for the file name call it , and make sure you select   from the drop-down arrow (Note: If you do not see   as a file type, you must put   in quotes.  ). Then save it in the same location your server is saved, and double click your   file. If all goes well, you will notice that you will have much more RAM available on your server!

If Windows does not recognize the filetype (You are being prompted to select a program to open it with), it may be because Minecraft_Server is missing the .exe extension. This can be fixed by renaming the Minecraft_Server file to Minecraft_Server.exe. If it worked, the icon should now be the Minecraft symbol.

If this does not work, you will have to go into a command window by opening Run, typing cmd and pressing enter. Once there you need to navigate to the folder you have created.

To do this:


 * 1) Ensure you are in the proper drive (usually C drive). Type  and then hit enter to access the c drive
 * 2) Now you need to call the directory (open the folder). Type  then hit enter.  Make sure to include the quotation
 * 3) Ensure you are in the proper directory. Type  and command will generate a list of contents of the folder, you should see minecraft_server there.
 * 4) Rename Minecraft. Type   then hit enter. This should add the .exe extension to the executable and it should now operate correctly.

Mac OS X instructions
Setting a server up in Mac OS X is "more involved" than in Windows because an executable file has not been made available. A video tutorial of the process can be seen here. Keep in mind that the server won't run correctly on OSX 10.4 and may crash your machine.

Downloading
Ensure you have the latest server application software. Look above for instructions.

Installing Java
Mac OS X already comes with its own version of Java that is updated automatically via Software Update (Apple menu > Software Update).

Setting up the Minecraft server
Ensure you have followed the download step before proceeding.


 * Create a folder, if you haven't already, and put minecraft_server.jar into it. For example, create a folder on the Desktop named minecraft_server and drag the jar file into it.
 * Open TextEdit, set the format to plain text (Format > Make Plain Text), copy and paste in the following:
 * Save the file as "start.command" in the same folder as minecraft_server.jar.
 * This will give the server enough RAM to run. The amount of RAM can be changed by editing the  to something else, such as   for 2 GB.
 * Open Terminal (in /Applications/Utilities/Terminal).
 * Grant execute permissions on file start.command to Owner, Group. and Public. To do so, type in , with a space after it; drag and drop the start.command file into the terminal window; and then press enter. (This gives run permission to the start.command script.)
 * Double-click the start.command file to start the server.
 * A new Terminal window will open and, the first time you run the script, several error messages about missing files/directories will appear. This is normal. You're now ready to configure your server.

Run as a daemon
Alternatively you can automate the startup of the Minecraft server.

Create a Mac OS X startup daemon

Linux instructions
This tutorial for how to set up a Minecraft server on Linux was designed for people who don't have a lot of experience with Linux. There is a more advanced tutorial in the forums. This tutorial was tested on Ubuntu 9.10 32-bit but should work with the descendants of Debian.

Downloading
Ensure you have the latest server application software. Look above for instructions.

Installing Java
If you get  (which may be followed by more text) or if you do have another Java version than 1.6 then you need to install or update java. The official Oracle Java is recommended. A few individuals have experienced issues with OpenJDK. Others report that running on OpenJDK is completely fine.

Debian
Ensure that the non-free repository is being scanned by apt. You do this by adding non-free to your  file. e.g.:

deb http://ftp.uk.debian.org/debian/ squeeze main non-free

Update your sources list (as root): apt-get update

Then to install Java, simply type this in terminal and press enter (as root): apt-get install sun-java6-jre

Ubuntu
Unfortunately, some licensing issues have prevented Canonical from allowing repositories to have Sun Java, so you must either download it directly from Oracle, package it, and install it or you could use the PPA provided by webupd8 by following the instructions below.

This guide has been tested on Ubuntu Server 12.10.

Note: You might need to install the packade "software-properties-common" by running  to use the   command.

Run the following commands in this order to add the PPA, update the source list and then install java:

Then run this to check what version you have installed:

The output should be similar to:

For more information or troubleshooting see this link at webupd8s site

openSUSE
On older versions, you can simlpy type  into a terminal.

On newer versions, there is a tutorial here describing how to install Java.

Arch Linux
Open a terminal and run  as root.

Gentoo
Use:

Other distros
Alternatively, you can visit Java's website directly to download the Java package for Linux. Most distros work with this (either 32 or 64-bit). Instructions for the installation of those different packages are given on the site.

If during installation, it asks for a password, enter your password. If you get asked "Is this OK [Y/N]" Enter Y and press enter if required. Java should now be installed.

Start the Minecraft server
Open the terminal again Applications > Accessories > Terminal Enter the following commands, substituting 'minecraft_server' with the name of the folder you extracted the server to:

Less than 1GB free RAM
If you have less than 1024MB RAM, the above line may cause problems with swapping and out of memory conditions, which makes the game hard to play.

It may look like this:



You are interested in the last number in the third line, 2163 in this case. Subtract some RAM as safety. On this computer, the server may use up to 1536 MB RAM. Now, replace the 1024 in the above example with the calculated number:

Voila, it should run smoothly now

Tip: If you want to spare more memory, you may set the -Xms parameter even lower, say:

The parameter controls how much memory is reserved on startup Your server will start with 32MB RAM and whenever it needs more memory it will allocate some until it reaches the maximum of 512 MB. However, this will result in a little slowdown whenever the allocation is done.

Startup and maintenance script
Alternatively you can manage/automate the startup and shutdown of the Minecraft server using a script such as the ones listed below:


 * Minecraft Server Manager A comprehensive start up script for Minecraft and Bukkit servers (support Debian, such as Ubuntu).
 * MSM can also periodically create World Edit compatible backups.
 * Keeps players informed with configurable in-game messages, such as "Shutting down in 10 seconds!"
 * Expose in-game commands (such as "say", "op" and "whitelist") to the terminal.
 * Tab completion on all commands makes learning easy.
 * Visit Minecraft Server Manager's GitHub page for the full list of features.
 * Server startup script
 * M3tal Warrior' Server Startup Script
 * For Debian (and should work on Ubuntu too); Bukkit and Vanilla compatible
 * Full backup and rollback routines
 * All ingame commands can be invocated
 * Supports using the RAM as server root file system
 * Multiple cron invocations to ease administration
 * Easy autoupdater
 * Easy installer for first timers
 * FreeBSD startup script
 * OpenBSD startup script
 * Ubuntu startup script

Port forwarding
Port forwarding is used when you have a router and you wish to let users connect to your server through it. if you wish to host your server for local reasons, it is not required that you do so. Keep in mind that port forwarding might cause security risks.

'''When port forwarding, it varies on how your router will ask you for the information. If you don't understand on how your router want's you to input the information, try visiting PortForward.com for a tutorial. If you still need help, please visit the Minecraft Forums and create a thread asking for help. You need to register'''

Once you have managed to locate your router's admin page, and find the Port Forwarding page; hit add new service (may not work) or custom service. When you get a page asking to setup the new rule, it should prompt you on what you want to call it. You may name it as you wish but for simplicity, name it "minecraft". Then you want to look for "type". Select TCP. For the ports (internal and external), enter 25565. If it asks for anything else other than output IP (or internal IP, server IP), leave it alone and continue.

For the out put IP address, use the following steps.


 * Windows
 * Locate to your desktop and hit start. From there, either search for cmd, or on previous versions of windows press "run" and type in cmd and hit enter. Once you have completed those steps, a console window should open. From there, enter "ipconfig /all" and press ENTER. From there, you should be given a list of text. Scroll up to Wireless LAN, and look at IPv4 address. On the right should be a couple of numbers, (xxx.xxx.xxx.xxx) copy this down by right clicking the window, and pressing mark; Highlight the area and hit enter. Don't copy any parenthesis or letters.


 * Mac


 * Locate your way to your desktop. Pull up the apple menu under the logo and scroll down to System Preferences; then select "Network" your IP should be on the lower right as "IP address (xxx.xxx.xxx.xxx). Once you have your IP, copy it down.


 * Linux
 * Either you use the network diagnose center (depending on distribution), or the terminal with ipconfig. The output should return all your interfaces. Search for inet addr:xxx.xxx.xxx.xxx, copy the xxx.xxx.xxx.xxx numbers down.

Once you have this IP, enter it in the "Output IP / Server IP" or what ever way it asks for where the service points to.

Once you have completed it, find where it says to save/continue/apply. And you have successfully port forwarded. When you run your minecraft server, you have to leave the Server IP field empty in the server properties.

For people to connect to your server, they must use your external IP, which you can find at websites such as IP Chicken. If you don't want to use such IP's, use DynDNS services such as NoIP DynDNS

Configure and connect
Now it is time to configure and connect.

Configuring the Minecraft server

 * 1) Configure the server by editing the server.properties file, the format for which is explained here. Be certain to edit the file with a text editor that does not add formatting (e.g., for italics). Additional configuration may not be necessary as many servers run fine from the default values.
 * 2) Add your username to the admin.txt and/or ops.txt (newer Minecraft versions may not have an admin.txt file).
 * 3) * Ops.txt and admin.txt determine who may execute server commands. In other words, operator ("op") privileges allow you to control certain aspects of the game (e.g., teleporting players).
 * 4) * Op privileges may also be granted from the server GUI: type "op " and it will automatically add to the ops.txt file. Being an op will not let you fly and/or have a creative inventory

Connect to the Minecraft server

 * If you are playing on the same machine on which the server is running, select the "Multiplayer" option in the game client, click direct connect, and then type in "localhost" instead of an IP address.
 * This is not recommended unless you have a powerful computer, with more than 6 gigabytes of ram (.5 for the server, 1 for the client, and remainder for system).
 * Users within your network (Accessing the same router) can connect with your internal IP address. (You do not need to port forward for connections that are within your local network.) The internal IP address of a specific device can be found by typing "ipconfig" into command prompt and looking for the ipv4 address.
 * People connecting from the Internet (i.e., outside of your local network) must connect using your external IP address. You must port forward for someone outside your network to connect to the server.

IP address notes

 * Unless you set a static IP for the computer that is hosting the game, the internal IP address can change. This affects port forwarding rules, and can make them invalid. Each modem or router has a different way of setting a static IP address. You should refer to the manual for your device(s) or online documentation for further instruction.
 * If you are having players connect to your external IP, your external IP can change if you do not have a static IP from your internet service provider. Use a tool such as MyWANIP to periodically check on the external IP address. You may also search "my ip address" on Google and it will show your IP address. Alternatively, you can look into a DNS service that will allow you to have a name, rather than an IP address, that will remain the same. The name will point to your external IP address, regardless of whether or not it changes (the DNS is updated when changes occur).

Firewalling, NATs and external IP addresses

 * You must open the TCP port (default is 25565) on the firewall.
 * If the server in question is not reachable via a globally routable IP address, you will need to add appropriate address and/or port number translation rules to the gateway — usually your router has the global IP address.
 * For help with address translation, opening the firewall and routing (these three make up what people call port mapping/forwarding), portforward.com is a good source. Select your router from that list, skip the ad that comes after selecting the device, and you will see instructions for setting up port forwarding. Alternatively, you can read the documentation supplied with your router, modem, or other ISP related hardware.
 * Verify the port is open, and note your external IP by using a port checker tool, such as You Get Signal. The default port you should test is 25565, unless you specified something else. Have the Minecraft server running when you test the port.
 * You can obtain your external IP address from YouGetSignal.

Local network dedicated servers
This only applies to Classic (v0.30) servers.

A common problem for server administrators is the inability to connect to your own server via another machine on your local network. A typical scenario for this is that you have a Classic server running on a dedicated machine, and you have your own machine which you play on. They're both connected to the same router/switch, and have internal IP's with the octets '192.168.x.x'. Normally, connecting via the URL generated for your server will result in an error message claiming that the server is offline.

To correct this, you must add a function to the end of your URL, bookmarks, or whatever else you connect by. The function is: ?override=true Example: http://www.minecraft.net/classic/play/4c3bebb1a01816acbe31c5ece1570da5?override=true

Previously, (before the 1.8 beta and website update) this was &override=true. This caused much confusion since the change was not announced by Mojang, and wasn't announced on the website applet pages either. Before the update, connecting to your own URL via the website resulted in red text under the applet window saying "If you can't connect, try this link instead." The link returned the same thing, with the &override=true affixed to the end.

Note: This situation does not effect Beta servers, and you should be able to connect via an internal or external IP.

Setting up a VPN (Hamachi)
An easy way to set up a server between you and your friends is to set up a VPN (virtual private network). A free software utility that can be used to set this up is Hamachi by LogMeIn. Don't use this for public servers. Many users will not take the extra time to install the client and such.

Advantage of doing this saves you configuring ports on your router and if you have a dynamic IP address using Hamachi will provide you with a static IP.


 * 1) Install software on you and your friend's computers  https://secure.logmein.com/products/hamachi2/ or https://secure.logmein.com/US/labs/?wt.ac=73-516-440 for Linux (32-bit and 64-bit .deb and .rpm packages are available, you can install it on Gentoo by emerging "net-misc/logmein-hamachi")
 * 2) One person sign up for admin via logmein website
 * 3) Create new network
 * 4) Pass these details onto every person concerned and get them to login
 * 5) One person set up a server.
 * 6) Everyone else connect via their Hamachi ip address and use port number 25565 (default)

FAQ (frequently asked questions)
Q: I have a problem which is not answered in here! What should I do to?

A: Go to the [Minecraft Forums and post your problem there. To help you, they need the following information: And please, if we were able to help you, post where the problem was exactly and what the fix was for that. Other people will appreciate that (and we will be able to get a grip on the common problems)!
 * Operating system
 * Version of Java
 * One machine or multiple computers
 * Exact description of the problem
 * Steps you have taken to solve the problem
 * Any errors you encountered
 * Screenshots of the problem (if possible)
 * Anything else that might help us to solve your problem - there almost never is too much information (passwords would be too much information!)

Q: When I try to connect to my server this is what it says: Connection lost The server responded with an invalid server key

A: Wait a minute then try again. If it persists, This is caused by either client / server version error. Try updating both client and server to the same version or post a thread. Update the server to 1.0.1 (aka 1.1) (this should fix it)

Q: On a Windows computer, when I double click the batch file it opens a command prompt window, but quickly disappears and the server does not start. What should I do?

A: Right-click your .bat program and hit edit; add a new line and type  save and run the file. If it says invalid path, it is probably due to an incorrect path for javaw.exe or your server software. You may just need to change  to. Or search your system for javaw.exe and adjust the path accordingly. (It's probably under  or  .) Also, you must have the offline version of Java installed—not just the Java plug-in for your browser.

You can also try replacing the contents of the .bat file with: START "minecraft" "C:\Program Files (x86)\Java\jre7\bin\javaw.exe" -Xms1024m -Xmx1024m -jar "Minecraft_Server.exe" amending name values/locations as required

Q: Whenever I try to get the server up, it says "Failed to Bind to Port."

A: This usually means that you have tried to use a port that is already in use or that you do not have permission to use (ports < 1024 are privileged and require root to bind to). You can try a different port by changing it in your  file in this line:.

Note: You should avoid using the following ports for your server as some ISPs may block these ports for security reasons and you shouldn't be running the Minecraft server as root (in the case of a Linux type OS and ports < 1024):
 * 21 (Used by most FTP Servers)
 * 22 (Used by Secure Shell daemon)
 * 25 (Used by Mail Servers for SMTP)
 * 53 (Used by DNS Servers)
 * 80 (Used by most Web Servers)
 * 110 (Used by most Mail Servers for POP3)
 * 115 (Used by Simple File Transfer Protocol)
 * 143 (Used by Mail Servers for IMAP)
 * 443 (SSL port for Web Servers)
 * 3306 (Used by most MySQL Servers)

Generally avoid any port below number 1024, since those ports are generally referred as well-known ports and are registered with the IANA for important services.

Q: I tried to run the server with Solaris/OpenSolaris and got the following error: java.io.InterruptedIOException: Operation interrupted at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) at java.net.SocketInputStream.read(SocketInputStream.java:182) at java.io.FilterInputStream.read(FilterInputStream.java:66) at gq.a(SourceFile:131) at ji.g(SourceFile:197) at ji.c(SourceFile:17) at oq.run(SourceFile:84) 2011-05-31 16:57:26 [INFO] /:44673 lost connection

A: For whatever reason, out of all of the operating systems, only Solaris throws that exception when a thread interrupts a connection. A workaround is to change the default behavior on the command line:

java -Xmx1G -Xms32M -XX:-UseVMInterruptibleIO -XX:+UseConcMarkSweepGC \ -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=$CPU_COUNT -XX:+AggressiveOpts\ -jar minecraft.jar nogui

This instructs Java to use an interruptible IO stack instead of the default IO that is sensitive to interrupted threads.

Q: I cannot break/place any blocks!?

A: Walk away from your spawn area. You cannot break or place blocks near spawn (unless you are operator on the server).

Q: My server runs fine but I cannot connect to it!

A: This could be caused by a series of issues. Please post a thread using the template provided above.

Q: How do you give a .jar server more ram?

A: Change the numbers in the server launch command "-Xmx1G -Xms1G". The -Xms part specifies how much memory the server starts with, and the -Xmx part is the maximum amount of memory the server can use. = 1GB And so on.

Q: How do I play on a LAN without access to the internet?

A: Set up an ad-hoc server—instructions for that are available elsewhere, and vary by your platform. In server.properties, change online-mode to false. Each player that wishes to join must use the following:

Windows batch:

or

Linux Bash (typical):

Don't be tempted to substitute "~" for "$HOME". It doesn't seem to interpolate as expected.

or

OS X:

In both Linux & OS X (& possibly Windows), protect USERNAME with quotes if you want to use spaces, etc.

Find your local IP, and other clients connect to that. If you run the client on the same computer that is acting as the server, connect to "localhost" (aka 127.0.0.1).

Note that if you run your server in offline mode, there is no authentication. This means that anyone who can access the server can connect with any username they want—including yours—without needing a password. When they do this, it will disconnect anyone using that same username. Ensure you're on a trusted network with appropriate isolation from the Internet.

---

Q: Be clear, how do you find out your server's IP address?

A: Read

Alternative/video tutorials
Here are some other tutorials on how to set up a Minecraft server:
 * Windows
 * How to Setup a 1.4.5 Minecraft Server on Windows
 * Port forwarding your Windows Minecraft server (with pictures)
 * Mac OS X
 * How To Setup a 1.4.5 Minecraft Server on a Mac
 * How to setup a 1.3.2+ Minecraft Server on OS X
 * Alternative video tutorial on setting up a Minecraft server with Mac OS X (includes port forwarding)
 * Linux
 * Linux tutorial for more advanced users
 * How to Install Minecraft Server on CentOS
 * Others
 * How to Setup Port Forwarding on your router (1.4.5)
 * Guide to setting up a server using Virtualbox.

Anleitungen/Server erstellen Tutoriels/Configurer un serveur 튜토리얼/서버 설치 Создание и настройка сервера 教程/架设服务器