OpenHAB 2.0 not working on Windows

I’m pretty new to OpenHAB, but I have a HUE and an EnOcean transmitter. The EnOcean transmitter can turn my enOcean lights on and off using DolphinView, so I’m doing pretty good that way.

I copied 2.0 (openhab-offline-2.0.0.zip contents) to C:\OpenHAB, but I can’t get the web UI working. I got it working just fine on a Linux laptop, but the computer in the room is Windows, so no need to put another computer there. Note that I got my HUE lights working on linux, so I seem to be able to connect to that pretty well (no luck with EnOcean yet).

Some of the BAT files are a bit messed up. They don’t have the correct newlines (CR rather than CRLF), so they don’t work correctly. I tried fixing them by typing them to the terminal and then copying the result to the files. That made the BAT files run, but the result is that it executes the JAVA command and then stops (see below). I set JAVA_HOME to C:\PROGRA~1\Java\jdk1.8.0_91 so there would be no spaces in the path, same result either way. I also turned ECHO OFF into ECHO ON in the BAT files so I could debug the issue (or at least ensure the BAT commands were running). The problem is that my web browser (chrome) can’t connect to the running server (if it even is running, i’m not sure) at localhost:8080. Java Mission Control says that Karaf is running. This all worked fine in linux.

C:\PROGRA~1\Java\jdk1.8.0_91\bin\java" -Dopenhab.home=C:\OpenHAB -Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\Open
ab.userdata=C:\OpenHAB\userdata -Dopenhab.logdir=C:\OpenHAB\userdata\logs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.serv
8443 -Dopenhab.home=C:\OpenHAB -Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\OpenHAB\runtime -Dopenhab.userdata=C:
openhab.logdir=C:\OpenHAB\userdata\logs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Dopenha
Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\OpenHAB\runtime -Dopenhab.userdata=C:\OpenHAB\userdata -Dopenhab.logdir=
ogs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -XX:+UseG1GC -Xms64m -Xmx256m -Djava.awt
f.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath “C:\OpenHAB\userdata\conf;C:\OpenHAB\runtime\karaf\bin
e.karaf.diagnostic.boot-4.0.4.jar;C:\OpenHAB\runtime\karaf\bin…\lib\boot\org.apache.karaf.jaas.boot-4.0.4.jar;C:\OpenHAB\runtim
ot\org.apache.karaf.main-4.0.4.jar;C:\OpenHAB\runtime\karaf\bin…\lib\boot\org.osgi.core-6.0.0.jar” -Djava.endorsed.dirs
k1.8.0_91\jre\lib\endorsed;C:\PROGRA~1\Java\jdk1.8.0_91\lib\endorsed;C:\OpenHAB\runtime\karaf\bin…\lib\endorsed" -Dja
A~1\Java\jdk1.8.0_91\jre\lib\ext;C:\PROGRA~1\Java\jdk1.8.0_91\lib\ext;C:\OpenHAB\runtime\karaf\bin…\lib\ext" -Dkaraf.
\runtime\karaf\bin…\instances" -Dkaraf.home=“C:\OpenHAB\runtime\karaf\bin…” -Dkaraf.base=“C:\OpenHAB\userdata
=“C:\OpenHAB\runtime\karaf\etc” -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=“C:\OpenHAB\userdata\tmp”
\OpenHAB\userdata” -Djava.util.logging.config.file=“C:\OpenHAB\userdata\etc\java.util.logging.properties” org.ap

Adding the full command from the window:

C:\OpenHAB\userdata>“C:\PROGRA~1\Java\jdk1.8.0_91\bin\java” -Dopenhab.home=C:\OpenHAB -Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\OpenH
AB\runtime -Dopenhab.userdata=C:\OpenHAB\userdata -Dopenhab.logdir=C:\OpenHAB\userdata\logs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.servi
ce.http.port.secure=8443 -Dopenhab.home=C:\OpenHAB -Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\OpenHAB\runtime -Dopenhab.userdata=C:\O
penHAB\userdata -Dopenhab.logdir=C:\OpenHAB\userdata\logs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -Dopenhab
.home=C:\OpenHAB -Dopenhab.conf=C:\OpenHAB\conf -Dopenhab.runtime=C:\OpenHAB\runtime -Dopenhab.userdata=C:\OpenHAB\userdata -Dopenhab.logdir=C
:\OpenHAB\userdata\logs -Dorg.osgi.service.http.port=8080 -Dorg.osgi.service.http.port.secure=8443 -XX:+UseG1GC -Xms64m -Xmx256m -Djava.awt.
headless=true -Dkaraf.startLocalConsole=true -Dkaraf.startRemoteShell=true -classpath “C:\OpenHAB\userdata\conf;C:\OpenHAB\runtime\karaf\bin.
.\lib\boot\org.apache.karaf.diagnostic.boot-4.0.4.jar;C:\OpenHAB\runtime\karaf\bin…\lib\boot\org.apache.karaf.jaas.boot-4.0.4.jar;C:\OpenHAB\runtime
\karaf\bin…\lib\boot\org.apache.karaf.main-4.0.4.jar;C:\OpenHAB\runtime\karaf\bin…\lib\boot\org.osgi.core-6.0.0.jar” -Djava.endorsed.dirs=
“C:\PROGRA~1\Java\jdk1.8.0_91\jre\lib\endorsed;C:\PROGRA~1\Java\jdk1.8.0_91\lib\endorsed;C:\OpenHAB\runtime\karaf\bin…\lib\endorsed” -Djava.
ext.dirs=“C:\PROGRA~1\Java\jdk1.8.0_91\jre\lib\ext;C:\PROGRA~1\Java\jdk1.8.0_91\lib\ext;C:\OpenHAB\runtime\karaf\bin…\lib\ext” -Dkaraf.insta
nces=“C:\OpenHAB\runtime\karaf\bin…\instances” -Dkaraf.home=“C:\OpenHAB\runtime\karaf\bin…” -Dkaraf.base=“C:\OpenHAB\userdata”
-Dkaraf.etc=“C:\OpenHAB\runtime\karaf\etc” -Dkaraf.restart.jvm.supported=true -Djava.io.tmpdir=“C:\OpenHAB\userdata\tmp”
-Dkaraf.data=“C:\OpenHAB\userdata” -Djava.util.logging.config.file=“C:\OpenHAB\userdata\etc\java.util.logging.properties” org.apache.
karaf.main.Main

Fixed by using 2.0.0.b3 instead of 2.0.0-SNAPSHOT

What version of Windows?

I am running openHAB 2 on Windows 7 and have not seen these issues.

If you load a clean copy of the snapshot into c:\openhab, then all should have to do is execute the start.bat batch file.

The start.bat file is quite simple and should look like:

@echo off

echo Launching the openHAB runtime...

setlocal
set DIRNAME=%~dp0%
"%DIRNAME%runtime\karaf\bin\karaf.bat" %*

I have never had to do anything to this file.

My Java directory is located under c:\program files and I can not remember having to alter any path information

Missed this while I was typing. Good stuff!!