OpenHAB 2 installation on Windows 10

Running start.bat Karaf writes

@OpenHABVirginia It is possible to run OpenHAB2 with JRE (=Java Runtime Environment) or JDK (=Java Development Kit). It seems that you have installed JRE.
I don’t exactly know if JDK is a prerequisite for “Starting OH2 as a service”. Please read very carefully this manual. Maybe you should install JDK first.

You can download it here: Oracle JDK Downloads

Don’t forget to switch
JAVA_HOME to C:\Program Files\Java\jdk1.8.0_131 or C:\Program Files (x86)\Java\jdk1.8.0_131
after installation…

Then follow all steps in the manual.

I haven’t tried setting JAVA_HOME to the JRE path but I believe that this should be enough and the windows service should work with only JRE installed.
I have installed JDK (and JRE) in my system and I made the docs entry using that… maybe I should update it :slight_smile:

Try the following please:

set the JAVA_HOME System Environment Variable to:

C:\Progra~2\Java\jre1.8.0_131

and try again… I have an idea why this is happening… :slight_smile:

@Dim I also tried to install “OpenHab as a Service”. I followed exactly the manual

Everything seems to be OK, but OH2-Website is not running:


http://127.0.0.1:8080/start/index

HTTP ERROR: 404

Problem accessing /start/index. Reason:

Not Found

Powered by Jetty://


When I start OH2 with start.bat, everything is OK.

hmmm…
anything useful in C:\openHAB2\logs\wrapper.log ?

@Dim

STATUS | wrapper  | 2017/07/06 10:39:45 | --> Wrapper Started as Service
STATUS | wrapper  | 2017/07/06 10:39:45 | Launching a JVM...
INFO   | jvm 1    | 2017/07/06 10:39:46 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2017/07/06 10:39:46 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
INFO   | jvm 1    | 2017/07/06 10:39:46 | 
INFO   | jvm 1    | 2017/07/06 10:39:48 | Jul 06, 2017 10:39:47 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO   | jvm 1    | 2017/07/06 10:39:48 | INFORMATION: Trying to lock C:\Openhab2-940\userdata\tmp\lock
INFO   | jvm 1    | 2017/07/06 10:39:48 | Jul 06, 2017 10:39:47 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFO   | jvm 1    | 2017/07/06 10:39:48 | INFORMATION: Lock acquired
INFO   | jvm 1    | 2017/07/06 10:39:48 | Jul 06, 2017 10:39:47 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFO   | jvm 1    | 2017/07/06 10:39:48 | INFORMATION: Lock acquired. Setting startlevel to 100

That’s all…

not much… (actually… it looks good… I have the same entries in my system where the service works)
strange… I can’t replicate this issue
how about setting a higher log level in openHAB2-wrapper.conf

wrapper.logfile.loglevel=DEBUG

and maybe anything in openhab.log ?

@dim I found the errors:

During startup (or installation?) of the OH2-service, the following file was modified: (don’t know why!! ??)

.\userdata\etc\ org.ops4j.pax.web.cfg (and some others!)

#
# http port. 
# This is currently also in the setenv
org.osgi.service.http.port = 8080

#
# https port, default is 8443. 
# This is currently also in the setenv
#
org.osgi.service.http.port.secure = 8443

both lines were commented with a # at the beginning

I removed them, and now it’s running!

I will check this also on my side…
So far, I haven’t seen the wrapper do crazy stuff… you never know :slight_smile:

I don’t think that this file (C:\openHAB2\userdata\etc\org.ops4j.pax.web.cfg) was modified.
I checked in my system and it is the same (http & https ports commented out… using defaults)
Whatever is configured there, ends up in C:\openHAB2\userdata\config\org\ops4j\pax\web.config
web.config pulls also C:\openHAB2\runtime\etc\jetty.xml where the ports are set (hmmm… only https is defined in there… not http)

Anyway… we have the wrapper.java.additional.16=-Dorg.osgi.service.http.port=8080 in the wrapper.conf… that should work.

I am testing more the windows service installation steps with various combinations… so far I haven’t been able to reproduce the issue…

I was always worried about this service wrapper since it does not use/take into account the scripts in runtime\bin…
That’s why the wrapper.conf is so complicated :frowning:

@Dim Please stop your investigations!

I removed “openHAB 2 Service”.

I switched in org.ops4j.pax.web.cfg back to:

#
# http port. 
# This is currently also in the setenv
# org.osgi.service.http.port = 8080

#
# https port, default is 8443. 
# This is currently also in the setenv
#
# org.osgi.service.http.port.secure = 8443

Then I installed “openHAB 2 Service” again. Indeed, the org.ops4j.pax.web.cfg was not modified!

Then I checked the openHAB2-service.bat created during wrapper-installation:

set APP_BASE=C:\Openhab2-940\userdata
set APP_ETC=C:\Openha~2\userdata\etc

In my very first attempt, I corrected:

from

 set APP_ETC=C:\Openha~2\userdata\etc 

to

set APP_ETC=C:\Openhab2-940\userdata\etc

because I thought this must be wrong, but it wasn’t, as I now know!

Now, everything is running!

Thanks for your support! :slightly_smiling_face:

1 Like

Now, everything is running also for me.

Thank you very much

1 Like

I am having the same 1067 error problem. I turned on debugging for wrapper and get this.

STATUS | wrapper | 2017/07/09 12:31:54 | Launching a JVM…
DEBUG | wrapper | 2017/07/09 12:31:54 | command: “C:\Program Files (x86)\Java\jdk1.8.0_131\bin\java” -Dkaraf.home=“C:\openHAB2\runtime” -Dkaraf.base=“C:\openHAB2\userdata” -Dkaraf.data=“C:\openHAB2\userdata” -Dkaraf.etc=“C:\openHAB2\userdata\etc” -Dcom.sun.management.jmxremote -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -Djava.endorsed.dirs=“C:\Program Files (x86)\Java\jdk1.8.0_131/jre/lib/endorsed;C:\Program Files (x86)\Java\jdk1.8.0_131/lib/endorsed;C:\openHAB2\runtime/lib/endorsed” -Djava.ext.dirs=“C:\Program Files (x86)\Java\jdk1.8.0_131/jre/lib/ext;C:\Program Files (x86)\Java\jdk1.8.0_131/lib/ext;C:\openHAB2\runtime/lib/ext” -Dopenhab.home=“C:\openHAB2” -Dopenhab.conf=“C:\openHAB2\conf” -Dopenhab.runtime=“C:\openHAB2\runtime” -Dopenhab.userdata=“C:\openHAB2\userdata” -Dopenhab.logdir=“C:\openHAB2\userdata\logs” -Dfelix.cm.dir=“C:\openHAB2\userdata\config” -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Xmx512m -Djava.library.path=“C:\openHAB2\userdata/lib/wrapper/” -classpath “C:\openHAB2\userdata/lib/wrapper/karaf-wrapper-main.jar;C:\openHAB2\userdata/lib/wrapper/karaf-wrapper.jar” -Dwrapper.key=“k71YZs6A5m0X1KuL” -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=“TRUE” -Dwrapper.pid=1088 -Dwrapper.version=“3.2.3” -Dwrapper.native_library=“wrapper” -Dwrapper.service=“TRUE” -Dwrapper.cpu.timeout=“10” -Dwrapper.jvmid=2 org.apache.karaf.wrapper.internal.service.Main
DEBUG | wrapper | 2017/07/09 12:31:54 | JVM started (PID=1848)
INFO | jvm 2 | 2017/07/09 12:31:55 | Error: Could not find or load main class org.apache.karaf.wrapper.internal.service.Main
DEBUG | wrapper | 2017/07/09 12:31:55 | JVM process exited with a code of 1, setting the wrapper exit code to 1.
ERROR | wrapper | 2017/07/09 12:31:55 | JVM exited while loading the application.
DEBUG | wrapper | 2017/07/09 12:31:55 | JVM was only running for 1 seconds leading to a failed restart count of 2.
DEBUG | wrapper | 2017/07/09 12:31:55 | Waiting 5 seconds before launching another JVM.
DEBUG | wrapper | 2017/07/09 12:31:59 | Classpath element, wrapper.java.classpath.1, does not match any files: C:\openHAB2\userdata/lib/boot/*.jar

This happens 5 times in the log.

Any help greatly appreciated

Did you fix the wrapper.conf file?
wrapper.java.classpath.1 should be pointing to %KARAF_HOME%/lib/boot/*.jar (C:\openHAB2\runtime\lib\boot)

Copy the entire contents from http://docs.openhab.org/installation/windows.html#starting-openhab-as-a-service (step 4)
and replace the existing contents of your C:\openHAB2\userdata\etc\openHAB2-wrapper.conf

1 Like

Thanks alot Dim. I must have missed erasing a line. Now it works as it should. Now on to next part of getting openhab completely set up and running for me.

1 Like

@Dim I followed your directions and still am having a problem getting the service started with Error 1607. In particular I did replace the wrapper.conf file as per your instructions. The JAVA_HOME is set to “C:\Program Files\Java\jre1.8.0_171” and OpenHAB works fine using start.bat.

The wrapper.log file shows:

STATUS | wrapper | 2018/05/24 09:07:57 | --> Wrapper Started as Service
STATUS | wrapper | 2018/05/24 09:07:57 | Launching a JVM…
FATAL | wrapper | 2018/05/24 09:07:57 | Unable to execute Java command. The system cannot find the file specified. (0x2)
FATAL | wrapper | 2018/05/24 09:07:57 | “%JAVA_HOME%\bin\java” -Dkaraf.home=“C:\openHAB2\runtime” -Dkaraf.base=“C:\openHAB2\userdata” -Dkaraf.data=“C:\openHAB2\userdata” -Dkaraf.etc=“C:\openHAB2\userdata\etc” -Dcom.sun.management.jmxremote -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -Djava.endorsed.dirs="%JAVA_HOME%\jre\lib\endorsed;%JAVA_HOME%\lib\endorsed;C:\openHAB2\runtime\lib\endorsed" -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\lib\ext;C:\openHAB2\runtime\lib\ext" -Dopenhab.home=“C:\openHAB2” -Dopenhab.conf=“C:\openHAB2\conf” -Dopenhab.runtime=“C:\openHAB2\runtime” -Dopenhab.userdata=“C:\openHAB2\userdata” -Dopenhab.logdir=“C:\openHAB2\userdata\logs” -Dfelix.cm.dir=“C:\openHAB2\userdata\config” -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Xmx512m -Djava.library.path=“C:\openHAB2\userdata\lib\wrapper\” -classpath “C:\openHAB2\runtime\lib\boot\org.apache.karaf.diagnostic.boot-4.1.3.jar;C:\openHAB2\runtime\lib\boot\org.apache.karaf.jaas.boot-4.1.3.jar;C:\openHAB2\runtime\lib\boot\org.apache.karaf.main-4.1.3.jar;C:\openHAB2\runtime\lib\boot\org.osgi.core-6.0.0.jar;C:\openHAB2\userdata\lib\wrapper\karaf-wrapper-main.jar;C:\openHAB2\userdata\lib\wrapper\karaf-wrapper.jar” -Dwrapper.key=“59DTeQAuCBjkTEY2” -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=13448 -Dwrapper.version=“3.2.3” -Dwrapper.native_library=“wrapper” -Dwrapper.service=“TRUE” -Dwrapper.cpu.timeout=“10” -Dwrapper.jvmid=1 org.apache.karaf.wrapper.internal.service.Main
FATAL | wrapper | 2018/05/24 09:07:57 | Critical error: wait for JVM process failed

Mike

I haven’t tested this stuff lately, so I will spend some time making sure that the https://docs.openhab.org/installation/windows.html is proper.

I followed step by step the instructions on Windows | openHAB and they worked perfectly for openHAB 2.3 RC2

what is the (cmd) output of:

echo %JAVA_HOME%

I have the same problem than mjcumming: I followed the OpenHab directions and still am having a problem getting the service started with Error 1607.

echo %JAVA_HOME% gives C:\Program Files\Java\jre1.8.0_191

OpenHAB works fine using start.bat.

The wrapper.log file shows:
STATUS | wrapper | 2019/05/15 12:10:21 | openHAB2 installed.
STATUS | wrapper | 2019/05/15 12:10:32 | --> Wrapper Started as Service
STATUS | wrapper | 2019/05/15 12:10:32 | Launching a JVM…
FATAL | wrapper | 2019/05/15 12:10:32 | Unable to execute Java command. The system cannot find the file specified. (0x2)
FATAL | wrapper | 2019/05/15 12:10:32 | “%JAVA_HOME%\bin\java” -Dkaraf.home=“C:\Users\regis\openhab-2.5.0.M1\runtime” -Dkaraf.base=“C:\Users\regis\openhab-2.5.0.M1\userdata” -Dkaraf.data=“C:\Users\regis\openhab-2.5.0.M1\userdata” -Dkaraf.etc=“C:\Users\regis\openhab-2.5.0.M1\userdata\etc” -Dcom.sun.management.jmxremote -Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true -Djava.endorsed.dirs="%JAVA_HOME%\jre\lib\endorsed;%JAVA_HOME%\lib\endorsed;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\endorsed" -Djava.ext.dirs="%JAVA_HOME%\jre\lib\ext;%JAVA_HOME%\lib\ext;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\ext" -Dopenhab.home=“C:\Users\regis\openhab-2.5.0.M1” -Dopenhab.conf=“C:\Users\regis\openhab-2.5.0.M1\conf” -Dopenhab.runtime=“C:\Users\regis\openhab-2.5.0.M1\runtime” -Dopenhab.userdata=“C:\Users\regis\openhab-2.5.0.M1\userdata” -Dopenhab.logdir=“C:\Users\regis\openhab-2.5.0.M1\userdata\logs” -Dfelix.cm.dir=“C:\Users\regis\openhab-2.5.0.M1\userdata\config” -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Djava.util.logging.config.file=“C:\Users\regis\openhab-2.5.0.M1\userdata\etc\java.util.logging.properties” -Dkaraf.logs=“C:\Users\regis\openhab-2.5.0.M1\userdata\logs” -Xmx512m -Djava.library.path=“C:\Users\regis\openhab-2.5.0.M1\userdata\lib\wrapper\” -classpath “C:\Users\regis\openhab-2.5.0.M1\runtime\lib\boot\org.apache.karaf.diagnostic.boot-4.2.2.jar;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\boot\org.apache.karaf.jaas.boot-4.2.2.jar;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\boot\org.apache.karaf.main-4.2.2.jar;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\boot\org.apache.karaf.specs.activator-4.2.2.jar;C:\Users\regis\openhab-2.5.0.M1\runtime\lib\boot\org.osgi.core-6.0.0.jar;C:\Users\regis\openhab-2.5.0.M1\userdata\lib\wrapper\karaf-wrapper-main.jar;C:\Users\regis\openhab-2.5.0.M1\userdata\lib\wrapper\karaf-wrapper.jar” -Dwrapper.key=“zDwrdV5aqHEuEhJG” -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=“TRUE” -Dwrapper.pid=11964 -Dwrapper.version=“3.2.3” -Dwrapper.native_library=“wrapper” -Dwrapper.service=“TRUE” -Dwrapper.cpu.timeout=“10” -Dwrapper.jvmid=1 org.apache.karaf.wrapper.internal.service.Main
FATAL | wrapper | 2019/05/15 12:10:32 | Critical error: wait for JVM process failed

Any suggestion?