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.