Can't Install

I’m a total beginner at this. I just downloaded OpenHAB and tried to install it (in Windows 8.1). When I try to run start.bat, it gives me errors like:
C:\Programs\OpenHAB2>start.bat
Launching the openHAB runtime…
‘-Dorg.osgi.service.http.port’ is not recognized as an internal or external command, operable program or batch file.
‘-Dorg.osgi.service.http.port.ssl’ is not recognized as an internal or external command, operable program or batch file.

Looking at the batch file, I don’t understand what the lines:
-Dorg.osgi.service.http.port=%HTTP_PORT%
-Dorg.osgi.service.http.port.ssl=%HTTPS_PORT%
are meant to do. That does not look like normal batch syntax to me.

What am I doing wrong here?

Thanks - Rowan

At which part of the Windows Installation Instructions do you experience issues?

It fails at step 3 of the section titled Installation. i.e I run start.bat, and it fails with the error messages that I quoted.

Thanks - Rowan

What Java did you install?

Those two lines are arguments to java.

My Java is:

C:\Users\RowanB>java -version

  java version "1.8.0_171"

  Java(TM) SE Runtime Environment (build 1.8.0_171-b11)

  Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode, sharing)

Is this OK?

Thanks - Rowan

That looks right. It looks to be a new enough Oracle Java. I don’t run on Windows so won’t be of much more help here. Most of the time the problem is forgetting to install Java or installing the wrong version. That doesn’t appear to be the case here.

Did you set the JAVA_HOME variable in Windows System Environmental Variables??

Yes, I did. JAVA_HOME is set to “C:\Program Files
(x86)\Zulu\Zulu10.2+3-jdk10.0.1-win_i686\bin”

  I had to include the quotes due to Windows' ridiculous habit of

including spaces in directory names. How come they didn’t see the
interminable problems that this decision would lead to?

Thanks - Rowan

That’s not the same version of Java you have listed above…

you may want to point to the Oracle Version 8.

It didn’t work with Oracle Java 8. So I installed the recommended version (Zulu v10). That didn’t work either, so I uninstalled Oracle. It still doesn’t work, and that’s the problem I am currently trying to solve. It seems to be missing some registry settings and not to be finding things in the directories it is looking in.

Thanks - Rowan

If you run java -version and it says “Hotspot” in the results it means you are running Oracle Java.

If you running Zulu it will say Zulu in the output from java -version.

And assuming it is running Zulu, you must run Zulu version 8. OH will not work with version 10.

The docs do say: “As for now, a pre-release Java 9 installation is not recommended and is not yet supported by openHAB 2.” but that probably needs to be updated to say as for now OH does not yet support any Java version after version 8.

Rick beat me to it…

I would uninstall your version 10 and revert back to Version 8. I think you might have some issues with the quotes you are placing within the system environmentals…it may be effecting the path.

Thanks for those hints. I stupidly missed that note about the version.

  I have now installed Zulu version 8, and adjusted the values of PATH and JAVA_HOME. I used a directory with no spaces in it so I could get rid of the quotes. Now when I enter java -version in a cmd window, I still get this:

C:\Users\RowanB>java -version

  Error: opening registry key 'Software\JavaSoft\Java Runtime Environment'

  Error: could not find java.dll

  Error: Could not find Java SE Runtime Environment.

If I enter the full path to Java, it works OK:

  C:\Users\RowanB>C:\Programs\Zulu\zulu8.30.0.1-jdk8.0.172-win_i686\bin\java -vers

  ion

  openjdk version "1.8.0_172"

  OpenJDK Runtime Environment (Zulu 8.30.0.1-win32) (build 1.8.0_172-b01)

  OpenJDK Client VM (Zulu 8.30.0.1-win32) (build 25.172-b01, mixed mode)

What is wrong now?

  Can I run OpenHAB by using the full path to Java? How do I do this?

Thanks - Rowan

It looks like you still have something referencing the Oracle install on your system or file path.

Have you rebooted since updating your environmental variables?

Squid

In point of fact I do not understand the start.bat file at all.

You say the two lines beginning -D are arguments for Java.

  What does the line setlocal mean? Java interprets this as the

name of a Jat file that it is meant to execute, which it (of
course) fails to find. This looks more like a command line command
than a Java command.

  And what does the line set DIRNAME=%~dp0% mean? This too looks

like a command line. What does %~dp0% mean?

  And what does the line "%DIRNAME%runtime\bin\karaf.bat" %* mean?

Presumably this is supposed to run the file karaf.bat. What does
the %* at the end mean?

If I try to run the file karaf.bat by entering the command line:

  C:\Programs\OpenHAB2>C:\Programs\Zulu\zulu8.30.0.1-jdk8.0.172-win_i686\bin\java

runtime\bin\karaf.bat %*

I get:

Error: Could not find or load main class runtime\bin\karaf.bat

Presumably it is again looking for a Jar file.

If I run karaf.bat as a normal command line, like this:

C:\Programs\OpenHAB2>runtime\bin\karaf.bat

I get:

karaf.bat: Ignoring predefined value for KARAF_HOME

  WARNING: Running Karaf on a Java HotSpot Client VM because

server-mode is not available.

  Install Java Developer Kit to fix this.

  For more details see

The system cannot find the path specified.

Must hijack this as i can`t make a new topic ! I to have problems installed on a headless pi. that seems to go good but in browser pirefox i go to

http://openhabianpi:8080/start/index

Nice page,there is choose a packet nothing happens ! on the skip package selection only a # come in the browser adress nothing else .
second problem is if i ssh so ssh openhiab@192.168.xx…xx then it ask password i use the one in the conf openhabian and it looks that is not ok so ? Any clue.

You should really start a separate thread as solutions for a Windows installation will probably not correspond directly to your challenge.

Squid

As i dit say i could NOT make a new topic

I don’t run on Windows and never have so I can’t say the bat file makes much sense to me either. But I know there are hundreds if not thousands of users who run OH on Windows so there being something fundamentally wrong with the .bat file seems unlikely or all those users would be complaining also.

So, assuming that there is nothing wrong with the .bat file the usual suspects for problems are:

  • wrong version of Java
  • environment variables like JAVA_HOME and PATH are not set up correctly
  • Something already using the network ports OH needs
  • Windows firewall is blocking access to the OH ports.

I can say for a fact that the -D are definitely arguments to Java. One uses the -D option to pass environment variables to the running application. In this case the two you point out are setting a couple of environment variables in the program to set the HTTP and HTTPS ports that OH will listen on. The %HTTP_PORT% is referring to a variable set by the .bat file, or that exists in your envrionment. If those variable do not exist then the defaults of 8080 and 8443 are used.

I just went through the steps on my Windows machine:

  1. My system already has Oracle Java 8 installed
  2. Added JAVA_HOME to my environment variables
  3. Downloaded the 2.3 R Manual Distro
  4. Extracted the zip file to C:\openhab2
  5. Ran start.bat

So unless you want to learn how the .bat file works, I think your time would be better spent looking at the list above for the source of your problem.

I don’t know for sure but I would guess it sets the language and perhaps the time zone and number formats and such that OH will use. So if you are in Germany all the logs and menus are in German and a comma is used for the decimal place and such.

A quick google search confirms this: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/setlocal

Everything in % % refers to a variable set somewhere. So this line is setting the variable %DIRNAME% to the value of the environment variable %~dp0%. And again, [a Google search tells me] (https://stackoverflow.com/questions/5034076/what-does-dp0-mean-and-how-does-it-work)

The %~dp0 (that’s a zero) variable when referenced within a Windows batch file will expand to the drive letter and path of that batch file.

Run the command located at %DIRNAMEruntime\bin\karaf.bat and pass all the command line arguments passed to this .bat file to that command (Google again tells me that is what the "%" means). And since %DIRNAME% was set to %~dp0~ and we now know that %~dp0% is the drive letter and path to the .bat file executing we know this makes the command c:\openhab2\runtime\bin\karaf.bat (we didn’t pass any arguments to run.bat so %* is blank.

Why would you try to run a .bat file using Java?

No, karaf.bat is a .bat file. This is Windows scripting. It has nothing to do with Java so Java can’t figure out how to run it. If you opened that file up I bet you would find java being called from that file.

Then at least hijack a thread that is a little closer to your problem. This thread is addressing getting OH running on Windows. Not many of the people on this thread will have any clue how to help you with your problem.

Or just wait the day it takes until you have permission to start a new thread, assuming that is your problem.

when i used too run on wiindows you had to start the start.bat as an admin or i got error messages and KARAF could not start im not sure if this helps just posted just incase