Update Java 11 references (#1312)
Fixes #1161 Signed-off-by: Wouter Born <github@maindrain.net>pull/1314/head
parent
769c2abd49
commit
ca1fd0536e
|
@ -157,7 +157,7 @@ An example output of the last log statement above is:
|
|||
2016-06-04 16:28:39.482 [DEBUG] [org.openhab.core.model.script.heating] Bedroom: Temperature 21.3°C, Mode NORMAL
|
||||
```
|
||||
|
||||
Note that, in the last example above, inclusion and formatting of values is done using [Java Formatter String Syntax](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html).
|
||||
Note that, in the last example above, inclusion and formatting of values is done using [Java Formatter String Syntax](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html).
|
||||
|
||||
## Log4j configuration and logging into separate files
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ Number Livingroom_Temperature "Temperature [%.1f °C]"
|
|||
If no state presentation and no square brackets are given, the Item will not provide a textual presentation of its internal state (i.e. in UIs no state is shown).
|
||||
This is often meaningful when an Item is presented by a non-textual UI elements like a switch or a diagram.
|
||||
|
||||
Formatting of the presentation is done applying [Java formatter class syntax](http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax).
|
||||
Formatting of the presentation is done applying [Java formatter class syntax](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html#syntax).
|
||||
|
||||
If square brackets are given, the leading `%` and the trailing formatter conversion are mandatory.
|
||||
Free text, like a unit, can be added before or after the formatter string.
|
||||
|
|
|
@ -134,7 +134,7 @@ Data-transfer-objects (DTOs map from Json/XML to Java classes) do not require Ja
|
|||
|
||||
## D. Language Levels and Libraries
|
||||
|
||||
1. openHAB generally targets the long time supported Java 8 and Java 11 releases with the following restrictions:
|
||||
1. openHAB generally targets the long time supported Java 11 releases with the following restrictions:
|
||||
* To allow optimized runtimes, the set of Java packages to be used is further restricted to [Compact Profile 2](https://www.oracle.com/technetwork/java/embedded/resources/tech/compact-profiles-overview-2157132.html).
|
||||
2. The [OSGi Core Release 7](https://osgi.org/download/r7/osgi.core-7.0.0.pdf) with [OSGI Compendium Release 7](https://osgi.org/download/r7/osgi.cmpn-7.0.0.pdf) is targeted, and newer features should not be used.
|
||||
3. [slf4j](http://slf4j.org) is used for logging.
|
||||
|
@ -149,7 +149,7 @@ Expensive operations should therefore rather be scheduled as a job.
|
|||
2. Creation of threads must be avoided.
|
||||
Instead, resort into using existing schedulers which use pre-configured thread pools.
|
||||
If there is no suitable scheduler available, start a discussion in the forum about it rather than creating a thread by yourself.
|
||||
For periodically executed jobs that do not require a fixed rate [scheduleWithFixedDelay](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleWithFixedDelay(java.lang.Runnable,%20long,%20long,%20java.util.concurrent.TimeUnit)) should be preferred over [scheduleAtFixedRate](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate(java.lang.Runnable,%20long,%20long,%20java.util.concurrent.TimeUnit)).
|
||||
For periodically executed jobs that do not require a fixed rate [scheduleWithFixedDelay](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ScheduledExecutorService.html#scheduleWithFixedDelay(java.lang.Runnable,long,long,java.util.concurrent.TimeUnit)) should be preferred over [scheduleAtFixedRate](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ScheduledExecutorService.html#scheduleAtFixedRate(java.lang.Runnable,long,long,java.util.concurrent.TimeUnit)).
|
||||
3. Bundles need to cleanly start and stop without throwing exceptions or malfunctioning.
|
||||
This can be tested by manually starting and stopping the bundle from the console (```stop <bundle-id>``` resp. ```start <bundle-id>```).
|
||||
4. Bundles must not require any substantial CPU time.
|
||||
|
|
|
@ -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 8 JDK if you did not have it installed.
|
||||
1. Install the Java 11 JDK if you did not have it installed.
|
||||
|
||||
::: warning Attention
|
||||
openHAB development requires **Java JDK version 8**.
|
||||
openHAB development requires **Java JDK version 11**.
|
||||
:::
|
||||
|
||||
1. Download the "Eclipse Installer": [can be downloaded from the Eclipse web site](https://wiki.eclipse.org/Eclipse_Installer)
|
||||
|
|
|
@ -6,7 +6,7 @@ title: IntelliJ
|
|||
# IntelliJ IDE
|
||||
|
||||
## Prerequisities
|
||||
- git, Maven, IntelliJ and Java 8 are installed
|
||||
- git, Maven, IntelliJ and Java 11 are installed
|
||||
|
||||
## Install OpenHAB distribution
|
||||
1. Install the official [openHAB distribution](https://www.openhab.org/download/)
|
||||
|
|
|
@ -15,7 +15,7 @@ Try [git - the simple guide](http://rogerdudler.github.io/git-guide/) as a start
|
|||
Add-ons and the 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 8 and that you have a rough idea of Git's workflow (eg "checkout", "branches", "push").
|
||||
The different guides of this chapter assume that you are somewhat familiar with Java 11 and that you have a rough idea of Git's workflow (eg "checkout", "branches", "push").
|
||||
|
||||
## Choose the Right Concept
|
||||
|
||||
|
@ -49,7 +49,7 @@ 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 buildsystem tool. On Windows: Must be available in %PATH%
|
||||
1. Java JDK 8, for example from Oracle [Oracle JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). On Windows: %JAVA% must be set.
|
||||
1. Java JDK 11, for example from Oracle [Oracle JDK 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html). On Windows: %JAVA% must be set.
|
||||
|
||||
You can use any IDE that is suitable for OSGi/Java development.
|
||||
We have prepared some step-by-step guides for the following IDEs:
|
||||
|
|
|
@ -47,7 +47,7 @@ More details about the OSGi architecture can be found at <https://www.osgi.org/d
|
|||
Modules (called **bundles**) are the smallest unit of modularization.
|
||||
Technically a bundle is a JAR file with additional meta information.
|
||||
This information is stored in file called [**manifest**](#important-definitions) file.
|
||||
The manifest file is part of the standard [Java specification](http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html#), but OSGi adds additional metadata to it in form of specific headers.
|
||||
The manifest file is part of the standard [JAR specification](https://docs.oracle.com/en/java/javase/11/docs/specs/jar/jar.html#jar-manifest), but OSGi adds additional metadata to it in form of specific headers.
|
||||
The *Bundle-SymbolicName* and the *Bundle-Version* headers uniquely identify a bundle.
|
||||
In OSGi is allowed to have **bundles with same name, but different version running at the same time.**
|
||||
|
||||
|
@ -65,7 +65,7 @@ Bundle-ManifestVersion: 2
|
|||
Bundle-Name: Example Plug-in
|
||||
Bundle-SymbolicName: com.example.myosgi; singleton:=true
|
||||
Bundle-Version: 1.0.0
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Import-Package: org.example.required
|
||||
Export-Package: org.example.provided
|
||||
```
|
||||
|
|
|
@ -153,7 +153,7 @@ A string representation of an event type can be found by a public member `TYPE`
|
|||
To subscribe to all available event types, use the public member `ALL_EVENT_TYPES` of the event subscriber interface.
|
||||
|
||||
The event subscriber provides a `TopicEventFilter` which is a default openHAB `EventFilter` implementation that ensures filtering of events based on a topic.
|
||||
The argument of the filter is a [Java regular expression](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).
|
||||
The argument of the filter is a [Java regular expression](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html).
|
||||
The filter method `EventFilter.apply()` will be called for each event on the event bus to which the event subscriber is subscribed (in the example above `ItemStateEvent` and `ItemCommandEvent`).
|
||||
If the filter applies (in the given example for all item events with the item name "ItemX"), the event will be received by the `EventSubscriber.receive()` method.
|
||||
Received events can be cast to the event implementation class for further processing.
|
||||
|
@ -176,7 +176,7 @@ To receive an already cast event the `receiveTypedEvent(T)` method must be imple
|
|||
To provide an event filter the method `getEventFilter()` can be overridden.
|
||||
- openHAB provides an `AbstractItemEventSubscriber` class in order to receive `ItemStateEvents` and `ItemCommandEvents` (more information can be obtained in the next chapter).
|
||||
- To filter events based on a topic the `org.eclipse.smarthome.core.events.TopicEventFilter` implementation from the openHAB core bundle can be used.
|
||||
The filtering is based on [Java regular expression](https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html).
|
||||
The filtering is based on [Java regular expression](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html).
|
||||
- The subscribed event types and the filter should be stored as class members (see example above) due to performance reasons.
|
||||
- If the subscribed event types are sufficient in order to receive all interested events, do not return any filter (in that case the method getFilter() returns null) due to performance reasons.
|
||||
- Avoid the creation of too many event subscribers.
|
||||
|
|
|
@ -65,9 +65,9 @@ The 32-bit JVM performs better on the ARM platform. Some add-ons use libraries t
|
|||
Check your current Java version by opening a command line console and typing `java -version`:
|
||||
|
||||
```text
|
||||
java version "1.8.0_121"
|
||||
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
|
||||
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
|
||||
openjdk version "11.0.9.1" 2020-11-04 LTS
|
||||
OpenJDK Runtime Environment Zulu11.43+55-CA (build 11.0.9.1+1-LTS)
|
||||
OpenJDK 64-Bit Server VM Zulu11.43+55-CA (build 11.0.9.1+1-LTS, mixed mode)
|
||||
```
|
||||
|
||||
## Setup variants
|
||||
|
|
|
@ -34,7 +34,7 @@ The following features are provided by the openHABian images out of the box:
|
|||
|
||||
- Hassle-free setup without a display or keyboard, connected via [Ethernet or Wi-Fi](#wifi-setup)
|
||||
- openHAB 2 in the latest stable version
|
||||
- Zulu Embedded OpenJDK Java 8 ([newest revision](http://zulu.org/zulu-community/zulurelnotes))
|
||||
- Zulu Embedded OpenJDK Java 11 ([newest revision](http://zulu.org/zulu-community/zulurelnotes))
|
||||
- [openHABian Configuration Tool](#openhabian-config) including updater functionality
|
||||
- openHAB Log Viewer (based on [frontail](https://github.com/mthenw/frontail))
|
||||
- Samba file sharing with [pre-configured to use shares](https://www.openhab.org/docs/installation/linux.html#mounting-locally)
|
||||
|
|
Loading…
Reference in New Issue