How to Install Minecraft Server as a Service

Minecraft as a windows service! Not that bad, but a bit tricksy.

Refs:

Download the server files:

Installing the Server

  • create the folder: “C:\program files\minecraft_server”, and copy minecraft.jar to this folder.
  • create the folder “C:\program files\minecraft_server\yajsw” and extract the contents of the yajsw download file to this folder.
  • double-click minecraft.jar to start the server
  • open windows task manager, processes tab, view -> select columns, PID
  • task manager -> applications tab -> right-click “minecraft server” -> go to process
  • write down the “PID” that the javaw.exe process is using.
  • open a command prompt, and go to C:\program files\minecraft_server\yajsw\bat
  • run: genConf.bat <pid number>
  • open the ‘wrapper.conf’ file in .\yajsw\conf with notepad
  • edit the following settings. Use double slashes in the config file!
    • wrapper.console.title=Minecraft Server Console
    • wrapper.working.dir=”C:\\Program\ Files\\minecraft_server”
    • wrapper.ntservice.name=minecraft
    • wrapper.ntservice.displayname=Minecraft Server
    • wrapper.ntservice.description=Minecraft server.
  • No other wrapper.conf settings need changed, even if they look blank and mandatory.
  • in a command prompt, go back to the .\yajsw\bat folder
  • run: InstallService.bat

Configuring the Server

  • Edit “server.properties” and change any settings you want.
  • Note: I couldn’t get the ‘admins.txt’ to work, so I installed the Hey0 mod to help with administration instead.
  • Configure windows firewall to allow minecraft outgoing — it’s port 25566 by default.
    • open a command prompt, and run:
    • netsh advfirewall firewall add rule name="Minecraft Sever - 25566" dir=in action=allow localport=25566 protocol=tcp

Extras

If you want to run the Hey0 mod, check out this post: Installing the Hey0 Minecraft Server Mod (as a Windows Service)

To-Do \ Wishlist

  • Powershell script to add admins based off of an AD group: “Minecraft Admins”
Advertisements

12 thoughts on “How to Install Minecraft Server as a Service

  1. I can’t get this to work. “getConfig.bat ” halts and returns:

    C:\Program Files\Minecraft\yajsw\bat>call setenv.bat
    java -Xmx30m -jar “C:\Program Files\Minecraft\yajsw\bat\/../wrapper.jar” -g 3420
    -d “C:\Program Files\Minecraft\yajsw\bat\/../conf/wrapper.conf.default” “C:\Pro
    gram Files\Minecraft\yajsw\bat\/../conf/wrapper.conf”
    ‘java’ is not recognized as an internal or external command,
    operable program or batch file.
    Press any key to continue . . .

    Any feedback would be greatly appreciated.

  2. Hi – I keep getting this error no matter what I try, does javaw.exe need to be quoted, for example: “C:\\Program Files\\Java\\jre6\\bin\\javaw.exe”

    D:\shares\minecraft\minecraft_Server\yajsw\bat>genconfig 6488

    D:\shares\minecraft\minecraft_Server\yajsw\bat>rem usage genconfig.bat [-d
    ]

    D:\shares\minecraft\minecraft_Server\yajsw\bat>cd D:\shares\minecraft\minecraft_
    Server\yajsw\bat\

    D:\shares\minecraft\minecraft_Server\yajsw\bat>call setenv.bat
    “java” -Xmx30m -jar “D:\shares\minecraft\minecraft_Server\yajsw\bat\/../wrapper.
    jar” -g 6488 -d “D:\shares\minecraft\minecraft_Server\yajsw\bat\/../conf/wrapper
    .conf.default” “D:\shares\minecraft\minecraft_Server\yajsw\bat\/../conf/wrapper.
    conf”
    07/04/2012 1:10:29 PM org.apache.commons.vfs.VfsLog info
    INFO: Using “C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\2\vfs_cache” as temporary files
    store.
    ************* GENERATING YAJSW CONFIGURATION FOR PID 6488 **********************
    *

    process command line:
    “C:\Program Files\Java\jre6\bin\javaw.exe” -Xms512m -Xmx1024m -jar “D:\shares\minecraft\minecraft_Server\Minecraft_Server.exe”

    creating java configuration file
    —————–
    Output file: D:\shares\minecraft\minecraft_Server\yajsw\bat\..\conf\wrapper.conf

    —————–
    NOTE: check/edit the following properties in the config file!

    wrapper.app.account, wrapper.app.password: either set the password or remove the
    account
    wrapper.java.command
    wrapper.working.dir
    wrapper.ntservice.name, wrapper.ntservice.displayname, wrapper.ntservice.descrip
    tion
    —————–
    Press any key to continue . . .

    D:\shares\minecraft\minecraft_Server\yajsw\bat>installService.bat

    D:\shares\minecraft\minecraft_Server\yajsw\bat>cd D:\shares\minecraft\minecraft_Server\yajsw\bat\

    D:\shares\minecraft\minecraft_Server\yajsw\bat>call setenv.bat
    “java” -Xmx30m -jar “D:\shares\minecraft\minecraft_Server\yajsw\bat\/../wrapper.
    jar” -i “D:\shares\minecraft\minecraft_Server\yajsw\bat\/../conf/wrapper.conf”

    07/04/2012 1:15:49 PM org.apache.commons.vfs.VfsLog info
    INFO: Using “C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\2\vfs_cache” as temporary files
    store.
    ************* INSTALLING C:\Program Files\Java\jre6\bin\javaw.exe **************
    *********

    error during install 123
    The filename, directory name, or volume label syntax is incorrect.
    Service C:\Program Files\Java\jre6\bin\javaw.exe NOT installed
    Press any key to continue . . .

    D:\shares\minecraft\minecraft_Server\yajsw\bat>dir “C:\Program Files\Java\jre6\bin\javaw.exe”

    Volume in drive C is SYS
    Volume Serial Number is 3C8B-5C6E

    Directory of C:\Program Files\Java\jre6\bin

    07/04/2012 11:11 AM 149,280 javaw.exe
    1 File(s) 149,280 bytes
    0 Dir(s) 7,214,534,656 bytes free

    D:\shares\minecraft\minecraft_Server\yajsw\bat>

  3. C:\Documents and Settings\my pc>C:\program files\minecraft_server\yajsw\bat
    ‘C:\program’ is not recognized as an internal or external command,
    operable program or batch file.

  4. The instructions worked amazingly. I was even able to use this to start up a Yogscraft Complete server. Instead of using the Mine_Craft directory, you have to use the Yogscraft Complete server location. Mine for example: “C:\atlauncher\Servers\YogscastCompletePack_2875RRYOGS”

  5. There is certainly an advantage, especially the Da Nhay BeachBy: Alo Trip Jul 29th 2014 – The renovators specialize in various different shapes & sizes.
    Large groups interested in entertainment and perhaps take advantage of an established
    limousine firm. If you only want to impress their surroundings.

  6. This guide worked great! Many Thanks

    I have not run my server 24/7 because we are a small private community. The server is never used over the day.

    I have my server shut down in a timed manner by task scheduling (during the week at night at 2 AM). Via my home control I leave the PC (Windows 7) then wake-up LAN by 4 PM again.

    This works so well!

    My question:
    Is there a way to call the server console when the Minecraft server is started as a service?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s