OH3 JDK version

What is the dependency that causes OH3 to be stuck on Java 11 (and not compatible with later versions at runtime) ?

Why do you think it isn’t compatible with later versions ?
Isn’t it rather the other way round, code that uses a feature that was introduced in say Java 14 will not run on Java 11 or 8.

1 Like

In my try last week I experienced the same.
maven is refusing to compile if you don’t exactly use version 11.
I had installed latest (v15 believe) and it did not work.
Downloading v11 it indeed worked. Maybe something needs to be set to allow higher versions of some parameters voodoo to convince maven to proceed

Like many projects openHAB focusses on supporting Java LTS releases.
The latest LTS release is Java 11. The next LTS will be Java 17.
There’s typically only 6 months of support on the non-LTS releases.

3 Likes

Oh - because when I downloaded the OH3 snapshot, it refused to work with Java 13. I had to source a new JDK11 in order to make it work at all (IIRC I also tried it with 12)

$> ./start.sh
Launching the openHAB runtime...
Could not create a builder for the system bundle.
$> java --version                                                                       
java 13.0.1 2019-10-15
Java(TM) SE Runtime Environment (build 13.0.1+9)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

This seemed odd to me, there seemed to be a strong direction to ‘only use JDK11’ hence my question…

That’s probably because Apache Karaf only supports Java 8-11, see:

OpenJDK no longer supports Java 13 since March 2020.

Except: https://issues.apache.org/jira/browse/KARAF-6624, wherein failure to start on JDK13/14 is treated as a bug, and has now been resolved.

So it looks like it’s a dependency that needs updating and it may then work after that?

Why are you so keen to use Java 13+ ?
Java 9 and 10 had never been supported too …

The reason java 9 and up was not supported has more to do with the breaking changes that were made in Java 9. Which required significant changes and is the reason people get stuck at java 8 in general. Thats a reason we only now move to a newer version of java. There is no such reason now, so its reasonable to expect newer versions would just work.

Because,

a) In common with many people, I didn’t actually have JDK11, only 13, because for work projects we’re using the additional features. This will end up much more common now java has woken up to a faster release cadence, it’s an ache to have to remember ‘oh this project is special and isn’t forwards compatible’, and

b) A lack of forwards-compatibility is a bad code smell IME. Java9,10,11 was /mostly/ OK with older projects provided you passed parameters to override some defaults. But I’m old enough to have the scar tissue from ancient Java 1.3 projects where “it’ll get upgraded before Java vNext comes out” turns out to be “we’re now on Java vNext+++++ and it still ties us to an old JVM”.

I thought it might be a possibility that the reason was something to do with a hard collision between OSGi/Karaf and Jigsaw, and I’m not up to date on that stuff.

So I guess, from a personal perspective, I’m fine with “this project defines a baseline of Java 11 for the code”, that’s fine by me, I can see why that’s a reasonable call. If it’s “it doesn’t work with any future version of Java, and this isn’t regarded as a bug”, then I’m likely to slowly start moving towards the exit from an “is this project worth spending time with” PoV…

They first need to release those Karaf versions before there is anything to upgrade to.
Since openHAB has many dependencies, you’ll probably run into another incompatibility after that. :wink:

2 Likes

One more information: it seems that Karaf does not run with every Java 11 variant.
I tested it on Windows 10 with openJ9 version 11 and got lots of Karaf error messages.
But with Azul JDK 11 it works fine.

BTW: it is no proble to use a specific JDK only vor openHAB. You only have to set the environment variable JAVA_HOME to a supported JDK and then start openHAB.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.