I know many of you guys have been wanting to know how to mess around with your .bat file to make it do what you want it to do. This is a small guide to help you out. A .bat file is just a launchable file that performs the task written within the file. First of all make sure you are using Notepad to edit the file. After you copied one of the texts below save it as "Launcher.bat" and it will automatically format it into a .bat file that you can use. Note: You can also replace "C:\Program Files (x86)\Java\jre6\bin\java.exe" with just "Java" but that is only if you have previously edited your Environmental Variables, under system properties to link the path to your Java location. This is more complicated so we will stick to the simple and in my opinion better method. =============================================================================== 32 bit USERS PLEASE READ HERE The maximum amount of RAM you will be able to allocate for your 32bit Java is 1024M (1GB)!!! 32 Java does recognize a maximum of 1536M (1.5GB) but will it will only use 1GB so if you get "Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine." You need to set it to -Xms1024M -Xmx1024M If this still fails your computer does not have enough RAM available. 32bit .bat should look like @echo off "C:\Program Files\Java\jre6\bin\java.exe" -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar pause =============================================================================== 64 bit USERS PLEASE READ HERE Lucky you you have an awesome computer!!! You can change the -Xms1024M -Xmx1024M to whatever you would like! For optimal performance use whole intervals of 1024M (1GB) Examples: 1GB = 1024 2GB = 2048 3GB = 3072 4GB = 4096 12GB=12288 <--- Thats me =D 64 bit .bat should look like @echo off "C:\Program Files\Java\jre6\bin\java.exe" -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar pause If you for some odd reason want to run your server on 32bit although you have 64bit use this path @echo off "C:\Program Files (x86)\Java\jre6\bin\java.exe" -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar pause =============================================================================== The Green is the directory where you computer will look for the java to run your program. You can see the location by right clicking your java.exe and looking at the security tab, it will be the object name. The Gray is the initial and maximum "heap" size. This is the amount of RAM you want to allocate for Minecaft. Please note that Java only takes whole GB increments so there is no point of making it 2560 (2.5Gb) because it will only use upto 2048(2GB). The Red is the .jar file you want java to execute. In this case it is "craftbukkit-0.0.1-SNAPSHOT.jar" you can rename the file to whatever you like but just make sure that the line in your .bat file has the same name or you will get an error message telling you it could not be executed. "Unable to access jarfile craftbukkit.jar" Because you did not name it "craftbukkit-0.0.1-SNAPSHOT.jar" Want to give you server a little boost? Go to your task manager (Ctrl-Shift-Esc), under processes find java.exe, right click it and under Set Priorities set it to Realtime. If it will not let you do this that is because you are not the administrator. To combat this simply click on "Show processes from all users" and try again. What this does it tells your computer that you think the Java program is important and thus your computer will focus on executing those tasks first. This might make other programs slower.
Just to add to this easy to follow guide, 1024 is the highest number you can throw into 32-bit Java (you can throw up to 1584 I think, but as you said, Java only uses it in 1GB increments). If you want 2GB or higher, you will have to use 64-bit Java - which based on the layout of your post, it is alluded to, just pointing it out in case people using 32-bit are wondering why they are getting the message: "Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine."
That's wrong, you inverted the directories, it should be: 32 bit .bat should look like @echo off "C:\Program Files\Java\jre6\bin\java.exe" -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar pause ------------------------------------------------------------------------------------------------------------- 64 bit .bat should look like @echo off "C:\Program Files (x86)\Java\jre6\bin\java.exe" -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar pause
The directories are correct, but the premise is that you are running both of these on a 64-bit OS, and decide whether you are running it in 32 or 64 mode. Technically on a 32-bit OS, the path to running 32-bit Java is the same as running 64-bit Java on a 64-bit OS. Your example shows running 32-bit java on a 32-bit machine under "32 bit .bat" and running 32-bit java on a 64-bit machine under "64 bit .bat"
thank you ! This tutorial saved my server. My friends were complaning about lag but now it's running super smoothly.I am very grateful for your explanation. =)
NO! you inversed them because 32 bit doesnt need specification of the x86 folder!!!! 64 bit has to have it because java is a 32 bit program and needs to be installed in the program files x86 for 64 bit!!! check your file system!!!
you are right, becous when i look in my server(64bit) i dont see java in C:\Program Files\ the only place were i could vind java is in C:\Program Files (x86) EDIT: oops i need to learn to first check it good than comment i didend had the 64bit version installed. but than again ther issent a x86 folder in a 32bit windows
If you are running 32bit Windows, you should only have a "C:\Program Files" If you are running 64bit Windows, you will have "C:\Program Files (x86)" for 32bit installs, and "C:\Program Files" for 64bit installs. These are just defaults though.
Sorry guys I realized that later on too. It's been a while since I owned a 32 bit computer but it should be fixed now. Sorry again. =/
A clarification for confused people 32bit means you have a x86 PC, but you only have one Program Files folder 64bit means you have a x64 PC, however you have two program files folders. The default one (Program Files) is for x64 compatible software. The other one (Program Files(x86) ) is for backwards compatibility with 32bit software
I can't use the .bat file to start my server right now this happened today Is this only me and how can I fix it?
ok so annoyed I've been trying to create a bukkit server with my friends but... the run files dont work so i just double click on the .jar with pail in it but also my friends compalin that they cant reach my server i just thought the run files would have something to do with it so someone PLZ HELP ME... and I've tried every one of the .bat files