Rasberry OH2 Error: Could not create the Java Virtual Machine

Hello,

I try to run Openhab on my Raspberry Pi Model B using the latest Raspbian Jessie. I Install like it’s shown in the Tutorial from Openhab Documentation

https://openhabdoc.readthedocs.io/de/latest/Raspberry/

when I Start Openhab it gives following Error

● openhab.service - A vendor and technology agnostic open source automation software for your smart home.
   Loaded: loaded (/etc/systemd/system/openhab.service; enabled)
   Active: failed (Result: exit-code) since Don 2017-02-09 20:25:35 CET; 3min 30s ago
  Process: 973 ExecStart=/usr/bin/openhab (code=exited, status=0/SUCCESS)
 Main PID: 979 (code=exited, status=1/FAILURE)

Feb 09 20:25:34 raspberrypi openhab[973]: find: "./server": Datei oder Verzeichnis nicht gefunden
Feb 09 20:25:35 raspberrypi openhab[973]: Launching the openHAB runtime..
Feb 09 20:25:35 raspberrypi systemd[1]: Started A vendor and technology agnostic open source automation software for your smart home..
Feb 09 20:25:35 raspberrypi openhab[973]: Unrecognized option: -console
Feb 09 20:25:35 raspberrypi openhab[973]: Error: Could not create the Java Virtual Machine.
Feb 09 20:25:35 raspberrypi openhab[973]: Error: A fatal exception has occurred. Program will exit.
Feb 09 20:25:35 raspberrypi systemd[1]: openhab.service: main process exited, code=exited, status=1/FAILURE
Feb 09 20:25:35 raspberrypi systemd[1]: Unit openhab.service entered failed state.

I need Help, I am not a Linux enthusiast but I am a home automation enthusiast :disappointed_relieved:

greetz Tobith

Check which Java version you are using with the following command:

java -version

You can install Oracle JDK 8 using:

sudo apt-get install oracle-java8-jdk

It is recommended to install the Zulu Embedded (hard float)

Hi,

first thank you for answering

I installed java like it’s writtten in the totourial

https://openhabdoc.readthedocs.io/de/latest/Raspberry/

root@raspberrypi:/home/pi# java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

after installing Zulu the Error changed and I cant confirm my Java Version any more.

pi@raspberrypi://home/pi $ java -version
-bash: /usr/bin/java: Keine Berechtigung
pi@raspberrypi://home/pi $ sudo su
root@raspberrypi:/home/pi# java -version
bash: /usr/bin/java: Keine Berechtigung

root@raspberrypi:/home/pi# sudo service openhab status ls
● openhab.service - A vendor and technology agnostic open source automation software for your smart home.
   Loaded: loaded (/etc/systemd/system/openhab.service; enabled)
   Active: failed (Result: exit-code) since Son 2017-02-12 21:04:59 CET; 1min 16s ago
  Process: 3355 ExecStart=/usr/bin/openhab (code=exited, status=0/SUCCESS)
 Main PID: 3361 (code=exited, status=126)

Feb 12 21:04:58 raspberrypi openhab[3355]: find: "./server": Datei oder Verzeichnis nicht gefunden
Feb 12 21:04:58 raspberrypi openhab[3355]: Launching the openHAB runtime..
Feb 12 21:04:58 raspberrypi systemd[1]: Started A vendor and technology agnostic open source automation software for your smart home..
Feb 12 21:04:59 raspberrypi systemd[1]: openhab.service: main process exited, code=exited, status=126/n/a
Feb 12 21:04:59 raspberrypi systemd[1]: Unit openhab.service entered failed state.
Feb 12 21:04:59 raspberrypi openhab[3355]: /usr/bin/openhab: 19: /usr/bin/openhab: java: Permission denied

I dont know what means " find: “./server”: Datei oder Verzeichnis nicht gefunden" could that be the problem ? Is this folder missing ?

Check if all the installation steps for Zulu were performed correctly:

More specifically

Step D. update-alternatives

I installed zulu again and I confirmed my Java version

root@raspberrypi:/opt/zulu/8u112# java -version
openjdk version "1.8.0_112"
OpenJDK Runtime Environment (Zulu Embedded 8.19.0.31-linux-aarch32hf) (build 1.8                                                                                        .0_112-b31)
OpenJDK Client VM (Zulu Embedded 8.19.0.31-linux-aarch32hf) (build 25.112-b31, m                                                                                        ixed mode, Evaluation)

after the instalation I tried starting OH2 and the error is the same agai

root@raspberrypi:/opt/zulu/8u112# sudo service openhab status ls
● openhab.service - A vendor and technology agnostic open source automation software for your smart home.
   Loaded: loaded (/etc/systemd/system/openhab.service; enabled)
   Active: failed (Result: exit-code) since Sam 2017-02-18 19:27:31 CET; 31s ago
  Process: 1199 ExecStart=/usr/bin/openhab (code=exited, status=0/SUCCESS)
 Main PID: 1206 (code=exited, status=1/FAILURE)

Feb 18 19:27:31 raspberrypi openhab[1199]: find: "./server": Datei oder Verzeichnis nicht gefunden
Feb 18 19:27:31 raspberrypi openhab[1199]: Launching the openHAB runtime..
Feb 18 19:27:31 raspberrypi systemd[1]: Started A vendor and technology agnostic open source automation software for your smart home..
Feb 18 19:27:31 raspberrypi openhab[1199]: Unrecognized option: -console
Feb 18 19:27:31 raspberrypi openhab[1199]: Error: Could not create the Java Virtual Machine.
Feb 18 19:27:31 raspberrypi openhab[1199]: Error: A fatal exception has occurred. Program will exit.
Feb 18 19:27:31 raspberrypi systemd[1]: openhab.service: main process exited, code=exited, status=1/FAILURE
Feb 18 19:27:31 raspberrypi systemd[1]: Unit openhab.service entered failed state.

Open the Control Panel
Go to System
Go to Advanced Systems Properties
Then Environment Variables
In System Variables, click Add
New Variable Name: _JAVA_OPTIONS
New Variable Value: -Xmx512M
Click OK