Java: command not found - Installation on LXC

I’ve created an LXC container (running Debian 12), and I let the internet guide me on how to install Java 21 (https://www.youtube.com/watch?v=_kgsvfRrZMg, using wget https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jre_x64_linux_hotspot_21.0.6_7.tar.gz). I then installed openhab 5.0 snapshot.

The Java installation seems to have worked:

erik@LXCNAME:/usr/local/jdk-21$ java --version
openjdk 21.0.6 2025-01-21 LTS
OpenJDK Runtime Environment Temurin-21.0.6+7 (build 21.0.6+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.6+7 (build 21.0.6+7-LTS, mixed mode, sharing)
erik@LXCNAME:/usr/local/jdk-21$ echo $JAVA_HOME
/usr/local/jdk-21
erik@LXCNAME:/usr/local/jdk-21$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/jdk-21/bin
erik@LXCNAME:/usr/local/jdk-21$ ls -pal
total 32
drwxr-xr-x  6 erik erik 4096 Mar 27 18:44 ./
drwxr-xr-x 11 root root 4096 Mar 27 18:38 ../
drwxr-xr-x  2 erik erik 4096 Jan 21 23:38 bin/
drwxr-xr-x  5 erik erik 4096 Jan 21 23:33 conf/
drwxr-xr-x 51 erik erik 4096 Jan 21 23:33 legal/
drwxr-xr-x  5 erik erik 4096 Jan 21 23:38 lib/
-rw-r--r--  1 erik erik 2400 Jan 21 23:38 NOTICE
-rw-r--r--  1 erik erik 1610 Jan 21 23:38 release

But openHAB refuses to find Java…:

erik@LXCNAME:/usr/local/jdk-21$ sudo systemctl stop openhab.service
erik@LXCNAME:/usr/local/jdk-21$ sudo systemctl start openhab.service
erik@LXCNAME:/usr/local/jdk-21$ sudo openhab-cli console

java command not found

Does anyone have an idea? Those damned permissions again?

Thanks in advance!

I used Zulu java as it has a deb install file and it does everything for you.

That’s not recommended for the Snapshot… I believe I’ve read here, that there is an issue with it.

I am running OH5 and it works. It isn’t a snapshot version though.

I’ using Oracle Java 21:

wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb

And it’s on a LXC Container (Proxmox host)

I went ahead and did this. With some success. However, openHAB stops here:

09:14:14.349 [INFO ] [org.openhab.core.Activator           ] - Starting openHAB 5.0.0 (Build #4559)
09:14:25.166 [INFO ] [b.core.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
09:14:35.185 [INFO ] [re.automation.internal.RuleEngineImpl] - Rule engine started.

And then nothing… But that’s probably something for another topic.

I would stop openHab and run sudo openhab-cli clean-cache
Then see if it starts.
Failing that then uninstall and try again?
Then it that fails try a stable version.

I already tried the cache method… The install was just fresh. I might try reinstalling, though.

I need a snapshot version, as I’m planning to use a feature that has not yet made it to the release version…

Is it a fresh install?
The log file said it was running.
Did the web page come up?

Hahah, so that was where the hold-up was. :sweat_smile:

So it is working?

It is.