Android and the OpenJDK
Johan Vos
johan at lodgon.com
Thu Dec 31 09:21:46 UTC 2015
Hi John,
There is a difference between the underlying class libraries and the UI
framework on top of it. Currently, Android uses the Harmony class
libraries. It appears they will use the OpenJDK class libraries in the
future.
On top of the class libraries, Android provides its own (specific) UI
framework. However, you can already run your JavaFX applications on top of
it, using the JavaFX SDK for Android (see http://javafxports.org).
The problem with Harmony is that it is somewhere between Java 6 and Java 7.
Fortunately, JavaFX 8 runs on top of Java 6/7 (we convert lambda's to inner
classes at compile time).
So while JavaFX 8 already runs on top of the current Android
implementations, it will be possible to use Java 8 API's in your JavaFX
application in the future.
To make it more complete, there are actually 3 "layers":
1. the VM/runtime
2. the class libraries
3. the ui framework
1.a. Android currently uses its own runtime, called ART.
1.b. A mobile port of the OpenJDK is being developed that will allow to use
the OpenJDK VM (hotspot), see http://openjdk.java.net/projects/mobile/
2.a. Android currently uses Harmony
2.b. The mobile port of the OpenJDK can be used to build class libraries
based on the OpenJDK sources. I don't know if those classes will be used by
Android, or if they will build the class libraries themselves. If the
latter happens, this is option 2.c.
3.a. Android comes with its own UI API (i.e. android.widget.Button),
running on {1.a/2.a}
3.b. JavaFX runs on top of any combination {[1.a,1.b],[2.a,2.b]} and uses
the standard JavaFX API that also works on Desktop, iOS and embedded.
I'm biased of course, but 3.b. seems the long-term solution to me. It is
already available and being used. We need to work more on performance and
fix issues, but in general, I am very positive about it.
- Johan
2015-12-31 9:37 GMT+01:00 John C. Turnbull <ozemale at ozemail.com.au>:
> I am a tad confused.
>
> Google has announced that its next version of Android will be based
> entirely on the OpenJDK.
>
> Could this be a eureka moment for JavaFX? I mean, wouldn't it be the case
> then that using JavaFX to develop an Android app would actually be a way to
> create a "native" app, hence significantly increasing the use of JavaFX and
> ensuring its longevity?
>
> -jct
More information about the openjfx-dev
mailing list