OpenHAB2 not starting as a windows service

  • Platform information:
    • Hardware: PC
    • OS: Windows 10 (1909)
    • Java Runtime Environment: jre1.8.0_241
    • openHAB version: 2.5.2

As you could see below I have an error 1067 occurs when I try to install OpenHAB2 as a windows service:

C:\Users\regis\openhab2>C:\Users\regis\openhab2\userdata\bin\openHAB2-service.bat install
wrapper | openHAB2 installed.

C:\Users\regis\openhab2>net start “openHAB2”
The openHAB2 service is starting.
The openHAB2 service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

OpenHAB 2.5.0.M3 was working well as a service but after the update of windows 10 to version 1909 the OpenHAB service disappeared. I have then updated it to 2.5.2.

I have tried the openhab documented method as well as the nssm one ( nssm install OpenHAB2 “C:\Users\regis\openHAB2\start.bat”. Both options install OpenHab in the windows service list but create an error when I try to start this service.

I could launch ok openhab 2.5.2 “by hand” with start.bat and the Karaf consol

If you want to try an alternative: https://github.com/tmrobert8/openhab-windows-utils/tree/master/Service

This will create a service that works exactly the same way as running start.bat (no need for modify files, etc). I’ve been running it for months this way…

Hello Tim, thank you for your solution but my problem was that I had a java update and I forgot to update the JAVA_HOME user AND system variables.

The user variable was updated and therefore I was able to launch openhab by hand but when I tried to launch openhab as a service it was using the system variable that was not updated with the proper Java reference…

Hmm, unfortunately that hack do not work for me.
Same error “System error 1067 has occurred.” when starting openHAB as a service (no matter if from Services window or via CMD net start openHAB2.
Regenerated service few times, still the same issue.
Manual start, even without JAVA_HOME user variable, just with system variable, worked and works OK.
As service start keeps failing with system variable set, then I also added user variable (just in case), no change.

OpenHAB 2.5.10 fresh install on Windows 10 Pro 10.0.19041 x64
Java seems to be latest to date. The x64 one from Oracle java.com, not a Zulu.
C:\OpenHAB\userdata\bin>java -version
java version “1.8.0_271”
Java™ SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot™ 64-Bit Server VM (build 25.271-b09, mixed mode)

JAVA_HOME C:\Program Files\Java\jre1.8.0_271

Any idea?

Look at the event viewer - I bet you’ll find more information on the error that is occurring…

Have you replaced wrapper.conf content as described in manuals (see step 4)? I’ve made that mistake several times before…
Second quess is the long path format. try to use PROGRA~1 in path defintion or quote the whole path.

Running all previous options didn’t work… service would not start. I’ve replaced wrapper.conf per instructions (copy#paste content) and service works fine. Thanks for the tip