Skip to content

Commit

Permalink
Java 21 for OH5 development
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Friedrich <[email protected]>
  • Loading branch information
holgerfriedrich committed Jan 8, 2025
1 parent 82a24a4 commit 2122c92
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions configuration/migration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ You should probably do your usual OS backup too to make sure you can get back to

openHAB (since version 4) requires Java 17. Most modern Linux OS have an `openjdk-17-jdk` package available for you to install but alternative solutions such as [Zulu's OpenJDK](https://www.azul.com/downloads/zulu-community/?version=java-17-lts&package=jdk) (which openHABian can install for you) are available and these may run faster on 32-bit armhf platforms such as the Raspberry Pi.

Upcoming openHAB 5 development requires Java 21.

You must also be on the relevant repository for openHAB, this hasn't changed for openHAB 4.x so the [same instructions for moving to it](https://www.openhab.org/docs/installation/linux.html#package-repository-installation) are still valid.

For DEB based installers (apt), your `.list` file should contain the line:
Expand Down
4 changes: 2 additions & 2 deletions developers/ide/eclipse.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ If you already have Eclipse installed it is recommended to perform a separate Ec

## Eclipse IDE Setup

1. Install the Java 17 JDK if you did not have it installed.
1. Install the Java 21 JDK if you did not have it installed.

::: warning Attention
openHAB development requires **Java JDK version 17**.
openHAB development requires **Java JDK version 21**.
:::

1. Download the "Eclipse Installer": [can be downloaded from the Eclipse web site](https://wiki.eclipse.org/Eclipse_Installer)
Expand Down
9 changes: 3 additions & 6 deletions developers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Try [git - the simple guide](https://rogerdudler.github.io/git-guide/) as a star
Add-ons and the openHAB core itself are written in Java.
Java is not hard to learn, but it helps if you have a general technical understanding of programming languages.

The different guides of this chapter assume that you are somewhat familiar with Java 17 and that you have a rough understanding of Git's workflow (e.g. "checkout", "branches", "push").
The different guides of this chapter assume that you are somewhat familiar with Java 21 and that you have a rough understanding of Git's workflow (e.g. "checkout", "branches", "push").

## Choose the Right Concept

Expand Down Expand Up @@ -49,13 +49,10 @@ Please ensure that you have the following prerequisites installed as well:

1. [Git](https://git-scm.com/downloads) For retrieving our source code and push changes back. On Windows: Must be available in %PATH%
1. [Maven 3.x](https://maven.apache.org/download.cgi) Our build system tool. On Windows: Must be available in %PATH%
1. Java JDK 17 or JDK 21, for example from Oracle [Oracle JDK 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) or [Oracle JDK 21](https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html). On Windows: %JAVA% must be set.
1. Java JDK 21, for example from Oracle [Oracle JDK 21](https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html). On Windows: %JAVA% must be set.

::: tip Note
Whereas we recommend Java 17 for running openHAB, development can be safely done on Java 21.
With default settings, the Java 21 compiler will generate Java objects compatible with JRE 17.
If you run your openHAB server on Java 21, you can enable native Java 21 objects by adding `-Pj21` to the Maven command line.
Note that our CI checks Java 17 and Java 21 compatibility, and we only use language features available in Java 17.
Whereas openHAB 4.x series was based on Java 17, starting with openHAB 5.0.0-SNAPSHOT, **Java 21 is required**.
:::

You can use any IDE that is suitable for OSGi/Java development.
Expand Down
5 changes: 3 additions & 2 deletions installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ You could also [download Azul Zulu](https://www.azul.com/downloads/zulu-communit
Oracle Java is also suitable for most configurations but it's not recommended. Licensing restrictions may apply.

::: warning
Java 17 is recommended for openHAB.
Using Java 21 is possible, but still considered experimental.
Java 17 is recommended for openHAB 4.x series.
OpenHABian can install Java 21, but only on the native 64-bit image.
Please note that versions of Java other than 17 and 21 are not supported at the moment.

Upcoming openHAB 5 will require Java 21.
:::

| Java Platform | Advantages | Disadvantages |
Expand Down
2 changes: 1 addition & 1 deletion installation/linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ When installing Zulu or Zulu Embedded from a .zip or .tar archive, make sure to

::: tip Note
Make sure to download Zulu or Java **17**.
Using Java 21 is possible, but still considered experimental.
Using Java 21 is possible, and will be required for openHAB 5.
:::

## Installation
Expand Down
2 changes: 1 addition & 1 deletion installation/synology.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Synology DiskStation

:::tip Note

openHAB 4 and higher need Java 17.
openHAB 4.x series requires Java 17.
You will need to provide a working Java installation on your DiskStation.
The sections below are written for Java 11 but the docs are not updated currently, since we have not secured knowledge about how to install Java 17 on the DiskStation.
If you can provide some proper sources and explanation, we are happy to include your contribution into this article.
Expand Down
2 changes: 1 addition & 1 deletion installation/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Please be sure you have installed the required supporting applications as descri

### Set the `JAVA_HOME` System Environment Variable in Windows

Note: If you have installed Zulu Java 17 (highly recommended for OH 4.x) you may skip this step because the JAVA_HOME environment variable was created during installation.
Note: If you have installed Java 17 (recommended for OH 4.x) or Java 21, you may skip this step because the JAVA_HOME environment variable was created during installation.

- Navigate to: Control Panel ➡️ System and Security ➡️ System ➡️ Advanced System Settings ➡️ Environment Variables ➡️ System Variables
- Create a New System Variable named JAVA_HOME (or update the existing one) to match the installation directory of the Java Platform chosen and installed in the step [Prerequisites]({{base}}/installation/index.html#prerequisites).
Expand Down

0 comments on commit 2122c92

Please sign in to comment.