How to make a batch file to start your Minecraft Bukkit server
When you’re going to start your local Bukkit server you will need to open up the command prompt, change directory to where your Minecraft server is located and then run a Java command with a few arguments. This is a really tedious process to do every time you need to start it. That’s why we should make a batch file named in the lines of RUNME.bat so that we with only one click can launch or server, but how do you make such a batch file? In this short article I’ll show you two great examples on how to make this easy file, it does not require more than two lines of code. To make a new batch file you simply open up notepad and save the file as name.bat and it will be a batch executable.
Making a batch file using a predefined Java path
If you’ve set Java into your System path variables, which I give a walk through of, this will be the easiest batch file since it will not need the path to the Java, and it looks something like this:
java -Xmx1G -jar craftbukkit.jar -o true
PAUSE
The second flag -Xmx1G tells the system to give the Bukkit server 1Gb of RAM but you could also set it like -Xmx1024M, I usually give my server 2Gb of my 8Gb I have – but depending on how many plugins and how many players you have it can be a lot lower than that. Try it out and see what fits your needs!
Making a batch file without defined Java path
If you’re unsure about how to set your System path variables, or you’ve had troubles doing it this few lines will make your life easier since this batch file will check for what system you are on x32- or x64-bit. And it will then run Java from the appropriate path, I would recommend you to read my guide on how to setting System Variables to make it easier in the future.
@ECHO OFF
IF /I "%PROCESSOR_ARCHITECTURE:~-2%"=="64" "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -jar "craftbukkit.jar"
IF /I "%PROCESSOR_ARCHITECTURE:~-2%"=="86" "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -jar "craftbukkit.jar"
PAUSE
Hopefully this will help, but as I mentioned two times above – it’s always easier to define the path to Java in your System Variables, because then you may run any type of Java from the command line with ease.
Comments