Minecraft Wiki
Advertisement

Verify and install the latest version of Java

  1. Make sure that you have Java 7 installed. To do this, we first need to open up a command (CMD) window.
  2. In Windows XP/Vista/7, whilst holding the Windows key down, press R to open the Run dialog. Type cmd and press enter.
    • Once the command prompt has opened, enter the following command, followed by the enter key:
      java -version
    • Java should display its version, which should read "Java version 1.7"
  3. If you get the error "'Java' is not recognized as an internal or external command, operable program or batch file.", then you may have a previous version (less than 1.6) of Java or Java may not be in your system path.
    • For 32-bit users you can obtain the latest version here: Java download page. If you use a 64-bit OS, ensure that you download the x64 Windows package.
    • After you have installed the latest version of Java try again with java -version.
      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: ;"c:\Program Files\Java\jre7\bin". If you use 32-bit Java on a 64-bit OS use: ;"c:\Program Files (x86)\Java\jre7\bin"
      7. Restart your computer.
      8. Now re-open the command prompt and try again.

Windows Vista/7 users: If these steps don't work for you, open the Control Panel and search for Java, then click Java (32 or 64-bit). Under the Java tab, click "View...". The installed version of Java will be listed under 'Platform'.

Windows instructions

Verify and install the latest version of Java

  1. Make sure that you have Java 7 installed. To do this, we first need to open up a command (CMD) window.
  2. In Windows XP/Vista/7, whilst holding the Windows key down, press R to open the Run dialog. Type cmd and press enter.
    • Once the command prompt has opened, enter the following command, followed by the enter key:
      java -version
    • Java should display its version, which should read "Java version 1.7"
  3. If you get the error "'Java' is not recognized as an internal or external command, operable program or batch file.", then you may have a previous version (less than 1.6) of Java or Java may not be in your system path.
    • For 32-bit users you can obtain the latest version here: Java download page. If you use a 64-bit OS, ensure that you download the x64 Windows package.
    • After you have installed the latest version of Java try again with java -version.
      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: ;"c:\Program Files\Java\jre7\bin". If you use 32-bit Java on a 64-bit OS use: ;"c:\Program Files (x86)\Java\jre7\bin"
      7. Restart your computer.
      8. Now re-open the command prompt and try again.

Windows Vista/7 users: If these steps don't work for you, open the Control Panel and search for Java, then click Java (32 or 64-bit). Under the Java tab, click "View...". The installed version of Java will be listed under 'Platform'.

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 stop in the server command window) and then edit some configuration files—as is explained below.

If you get an error such as "Can't save server.properties" and your screen fills with useless, gibberish text, close the command prompt window and run 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
    java -Xms512M -Xmx1G -jar minecraft_server.jar (add in -d64 if your server is on a 64-bit computer using 64-bit java)
  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.

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
    @echo off
    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
    path=%PATH%;%ProgramFiles(x86)%\Java\jre7\bin
    where %PATH% contains the existing Path values and %ProgramFiles(x86)% 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:
    java -Xms512M -Xmx1G -jar minecraft_server.jar (If you are using 1.6.1 or 1.6.2, change the part of minecraft_server.jar to what your .jar file is, such as minecraft_server.1.6.2.jar)
  5. If you prefer not to use the server's Graphical User Interface (GUI) to enter administration commands, simply add the option nogui to the end of the last command above, so that it reads:
    java -Xms512M -Xmx1G -jar minecraft_server.jar nogui


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 Xmx2048M of maximum memory to run minecraft. The D: 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 Programs and Files . I also chose not to use the @echo off . The title run-minecraft 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.

title run-minecraft
path=%PATH%;%C:\"Program Files"\Java\jre7\bin
D:
cd minecraft
java.exe -Xms1048M -Xmx2048M -jar minecraft_server.jar nogui

Optional steps

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...
    1. If Windows is 32-bit or Windows is 64-bit with 64-bit Java, copy this into your document:
      javaw -Xms1024m -Xmx1024m -jar "Minecraft_Server.exe"
    2. 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.
    3. 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
    • So what does all of this mean? The executable command ("C:\Program Files\Java\jre7\bin\javaw.exe") 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 (-Xms1024m -Xmx1024m) 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 -jar, this indicates that Minecraft_Server.exe is a Java archive.
    • Lastly in the executable command is the name of our .exe file (Minecraft_Server.exe). Typically, it is named Minecraft_Server.exe. Upper and lower case does matter. Rename Minecraft_Server.exe to whatever you named your file. Then click File->Save As... and for the file name call it run.bat, and make sure you select *.* All File Types from the drop-down arrow (Note: If you do not see *.* All File Types as a file type, you must put run.bat in quotes. "run.bat"). Then save it in the same location your server is saved, and double click your run.bat 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 C: and then hit enter to access the c drive
  2. Now you need to call the directory (open the folder). Type cd \"folder name" then hit enter. Make sure to include the quotation
  3. Ensure you are in the proper directory. Type dir and command will generate a list of contents of the folder, you should see minecraft_server there.
  4. Rename Minecraft. Type rename minecraft_server minecraft_server.exe then hit enter. This should add the .exe extension to the executable and it should now operate correctly.
Advertisement