Checkout Knopflerfish
Knopflerfish on GitHub
Follow knopflerfish on Twitter

Knopflerfish OSGi & Java Compatibility Guide

Knopflerfish as well as Java has evolved over the years and it is becoming more and more difficult to get an overview of what different version of Knopflerfish, OSGi specifications and Java actually work together. This page attempts to make this a bit more clear.

Knopflerfish Distribution Builds

The table below describes the different Knopflerfish distribution builds, what java run-time environments, they support, the Java / JDK version the Knopflerfish source code is compatible with, and which byte code version the source code is compiled into.

In general, the Knopflerfish distributions are always compiled into the least Java/JDK version the source code supports. This is to support the embedded market where many JVM:s are still on JDK1.6 level, or even older.

Since all code is upwards compatible Knopflerfish can easily be compiled into a more recent version of Java, including Java8. Please see the table later on this page presenting javac compatibility issues.

Knopflerfish Major Distribution Builds, OSGi and Java Version Guide
KF Version OSGi JDK Byte code Supported Java Run-times EE
6.* OSGi R6 1.6 50 1.6+ OSGi min 1.2
5.* OSGi R5 1.4 48 1.4+ (headless or AWT)
1.5+ (when using swing based bundles, e.g. desktop)
OSGi min 1.2
4.* OSGi R4 v4.3 1.4 48 1.4+ (headless or AWT)
1.5+ (when using swing based bundles, e.g. desktop)
OSGi min 1.2
3.* OSGi R4 v4.2 1.2 45 1.2+, PJava 1.2 (headless or AWT)
1.5+ (when using swing based bundles, e.g. desktop)
OSGi min 1.2

A plus-sign after a Java version indicates it supports that version and higher.

Please also note that some of Knopflerfish utility bundles that are uses Swing, e.g. the desktop bundle, do require Java 1.5 or higher.

Building Knopflerfish

The table below describes the different Knopflerfish versions and which JDK versions can be used to build them.

KF6 is designed to run on Java 1.6 and upwards. To run Knopflerfish on older versions of Java KF5 or earlier must be used.

KF6 can be built using Java 1.6 or higher and the byte code generated will be made for the tool chain used. E.g. if building KF6 with Java 8 the bundles will be built for Java 8 by default.

KF5 and KF4 are both designed to run on Java 1.4 and upwards. With OSGi R4 v4.3 Java 5 generics were introduced in the OSGi APIs. To be able to build a KF distribution that is compatible JDK 1.4 the the javac flag -target jsr14 is used to remove generics. This has the drawback that such compiled .class files can not be used when building on JDK 1.7 since support for jsr14 has been removed in Java 7. To use Knopflerfish artifacts in a JDK 1.7 based tool chain KF5 must therefore be built using JDK 1.7. When building KF5 using JDK 1.7 the default is to generate Java byte code for JDK 1.5 and upwards which is compatible with a JDK 1.7 tool chain.

Knopflerfish Major Distribution Builds, javac and JDK Version Guide
KF Version OSGi KF Source Code Build Environment Generates byte code for Tool Chains1 Comment
6.* R6 1.6 1.6 JDK 1.6 (50) 1.6+ The default is to build for JDK used
1.7 JDK 1.7 (51) 1.7+ The default is to build for JDK used
1.8 JDK 1.8 (52) 1.8+ The default is to build for JDK used
5.* R5 1.5 (1.6)2 1.5 - 1.6 JDK 1.4 (48) 1.4-1.6 KF build system default when using JDK 1.5 - 1.6. Generics removed during compilation by using -jsr14 flag
1.7+ JDK 1.5 (49) 1.5+ KF build system default when using JDK 1.7. Generics are not removed and therefore require Java 1.5 or higher
1.5 - 1.6 JDK 1.5 (49) 1.5+ Supported, but not out of the box. Requires setup changes in the KF build system for this build, e.g. modifying the -target flag
1.7+ JDK 1.7 (51) 1.7+ Supported, but not out of the box. Requires setup changes in the KF build system for this build, e.g. modifying the -target flag
4.* R4 v4.3 1.5 1.5 - 1.6 JDK 1.4 (48) 1.4 - 1.6 OSGi R4 v4.3 introduced generics in API classes. Generics are removed during compilation by using -jsr14 flag
3.* R4 v4.2 1.2 1.3+ JDK 1.2 (46) 1.2+

1 Indicates which version of the Java tool chain is needed to build third party code and using Knopflerfish bundle jars on the build path.

2 In KF5 JDK 1.6 annotations recognized by IDEs have been introduced. The source code still remain java 1.5 compatible.