openHAB 5.x-SNAPSHOT requires Java 21

Deploying a 5.0.0-SNAPSHOT binding to 4.3 release instance can be done (as long as there are not breaking API changes) as follows:

You need a Java 21 compiler, no need for a Java 17 compiler.

  1. Run your 4.3 instance on Java 21. OH 4.3 perfectly runs on Java 21 as well. openHABian-config can be used to switch to Java 21 on RPI. Keep in mind that the future-proof setup is a 64-bit system, at some point in time a binding might require a 64-bit system. OH5 bindings compiled for Java 21 can be deployed just as usual.
    or
  2. Keep your 4.3 instance running on Java 17. Use Java 21 to compile your binding, but generate Java 17 code. We have a profile j17 in place in the addons repo to do this without modifying the pom file: mvn install -Pj17 -Dohc.version=4.3.0. This will only work for bindings which do not require specific Java 21 libraries or features. Same remark as above: Keep in mind that the future-proof setup is a 64-bit system, at some point in time a binding might require a 64-bit system. IDEs might need some tweaking, otherwise you might end up with some Java 21 classes in the target folder.

tl;dr:
Run openHAB 4.3 on a 64-bit system with Java 21 if you want to use 5.0.0-SNAPSHOT bindings.

4 Likes