Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to start a Minecraft Server as a Service in a Windows Server 2008 R2 machine.

This command line works fine:

c:\Windows\System32\java.exe -cp c:\Data\minecraft-server\minecraft-server.jar com.mojang.minecraft.server.MinecraftServer -Xms512M -X mx512M

The I created a service using the following SC command:

sc config MinecraftServer binPath= "c:\Windows\System32\java.exe -cp c:\Data\minecraft-server\minecraft-server.jar com.mojang.minecraft.server.MinecraftServer -Xms512M -Xmx512M"

The service is created and when I start the service Windows starts it but then it comes back with a message that says:

The service is not responding to the control function.

The service does start but for some reason the command does not let the system know that it is started.

There is something simple that I've missed but I am not very experienced with Java so if anoyone here can give my guidance it would be very welcome!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can't just run any old EXE as a service. Services need to respond to callbacks from the Service Control Manager, and running a non-service EXE as a service will cause the messages you're seeing.

You can use a tool like NSSM, SRVANY, or any of a number of other service "wrapper" programs to get a non-service EXE to run as a service.

On the Java-specific front the WinRun4J application acts as a replacement for "java.exe" and can be used to start Java programs as services. I've used it when the command-line for a Java program was too long for the Service Control Manager to handle.

share|improve this answer

Refer to this thread on stackoverflow

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.