OpenHAB java error next to a nextcloud installation

I am trying to install openHAB next to a running nextcloudpi system on my raspi4 (I hope that is not the cause of my issue).

Regardless, I have started to do the steps according to the “Manual Setup” in the docs. The first difference occurred after the Zulu installation. I could not choose an alternative when I sent the command:

sudo update-alternatives --config java

So, it seemed that only Zulu and no alternative had been installed up to that point. Meanwhile, I have installed some other versions and the open-jdk as well. The output now is:

  0            /usr/lib/jvm/java-11-openjdk-arm64/bin/java                      1111      auto mode
  1            /opt/jdk/zulu11.43.100-ca-jdk11.0.9.1-linux_aarch32hf/bin/java   1         manual mode
* 2            /opt/jdk/zulu11.45.27-ca-jdk11.0.10-linux_aarch32hf              1         manual mode
  3            /usr/lib/jvm/java-11-openjdk-arm64/bin/java                      1111      manual mode

The next difference occurs when i start the installtion of openHAB:

sudo apt-get install openhab

openHAB cannot detect Java:

...
[openHAB] WARNING: We were unable to detect Java 11 on your system. This is needed before openHAB can be started.
[openHAB] Please install the current version of Java 11 or check the openHAB documentation for details.
Processing triggers for systemd (241-7~deb10u6) ...

Logically I have errors when starting openHAB service with

sudo systemctl start openhab.service

The status says:

pi@nextcloudpi:~ $ sudo systemctl status openhab.service
● openhab.service - openHAB - empowering the smart home
   Loaded: loaded (/usr/lib/systemd/system/openhab.service; disabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2021-02-28 09:21:32 GMT; 4s ago
     Docs: https://www.openhab.org/docs/
           https://community.openhab.org
  Process: 1819 ExecStart=/usr/share/openhab/runtime/bin/karaf ${OPENHAB_STARTMODE} (code=exited, status=1/FAILURE)
 Main PID: 1819 (code=exited, status=1/FAILURE)

And the logfile:

sudo journalctl -u openhab.service -b
-- Logs begin at Sun 2021-02-28 08:29:11 GMT, end at Sun 2021-02-28 09:22:33 GMT. --
Feb 28 09:21:17 nextcloudpi systemd[1]: Started openHAB - empowering the smart home.
Feb 28 09:21:17 nextcloudpi karaf[1765]: java command not found
Feb 28 09:21:17 nextcloudpi systemd[1]: openhab.service: Main process exited, code=exited, status=1/FAILURE
Feb 28 09:21:17 nextcloudpi systemd[1]: openhab.service: Failed with result 'exit-code'.
Feb 28 09:21:22 nextcloudpi systemd[1]: openhab.service: Service RestartSec=5s expired, scheduling restart.
Feb 28 09:21:22 nextcloudpi systemd[1]: openhab.service: Scheduled restart job, restart counter is at 1.
Feb 28 09:21:22 nextcloudpi systemd[1]: Stopped openHAB - empowering the smart home.
Feb 28 09:21:22 nextcloudpi systemd[1]: Started openHAB - empowering the smart home.
Feb 28 09:21:22 nextcloudpi karaf[1785]: java command not found

Furthermore, no java-version appears when select Zulu as active configuration:

pi@nextcloudpi:~ $ java -version
-bash: java: command not found

otherwise when activating openjdk the output is:

pi@nextcloudpi:~ $ java -version
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1deb10u2)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1deb10u2, mixed mode)

Is there a way to fix this?

Options 0, 1, 3 have bin/java at the end.
Option 2 does not have java bin/java at the end. So it is missing ?

1 Like

Option 2 does not have /bin/java at the end, yes.
I reinstalled openhab with Option 1:

 sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-arm64/bin/java                      1111      auto mode
* 1            /opt/jdk/zulu11.43.100-ca-jdk11.0.9.1-linux_aarch32hf/bin/java   1         manual mode
  2            /opt/jdk/zulu11.45.27-ca-jdk11.0.10-linux_aarch32hf              1         manual mode
  3            /usr/lib/jvm/java-11-openjdk-arm64/bin/java                      1111      manual mode

sudo apt-get purge openhab*
sudo apt-get install openhab

But still get the warning:

[openHAB] WARNING: We were unable to detect Java 11 on your system. 
This is needed before openHAB can be started.`

I fixed the problem. I think there were two mistakes:

#1:
I made a mistake when replacing the zulu path

 sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu11.43.100........
 sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu11.43.100.......

I have miss the ending (bin/java)

#2
I have picked the wrong zulu version regarding my architecture.
because:

pi@nextcloudpi:/opt/jdk $ dpkg --print-architecture
arm64

Due to this fact, i have chosen the 64bit zulu version.

And now the create new admin screen appears.

1 Like