HumblePi
Posts: 5
Joined: Thu Jul 19, 2012 8:54 pm

Yay, Java JDK Coming for Raspberry Pi

Wed Aug 15, 2012 9:22 pm

Here is a quote from https://blogs.oracle.com/henrik/entry/o ... _for_linux which should interest many Raspberry developers:
Oracle releases JDK for Linux ARM, JRE for Mac OS X
By Henrik Stahl on Aug 14, 2012

Earlier today, we announced (among other things) the availability of JDK 7 Update 6. This release contains an update to the Mac OS X port, as well as the addition of a new JDK port to Linux ARM.

The Java 7 port to Mac OS X has been long in the making. We have been working on it in OpenJDK with Apple since November 2010, and it has been quite a lot of work both in the JDK/JRE and in OS X to get to this point. A lot of work has been done behind the scenes on seemingly trivial but time-consuming tasks such as extending the build & test infrastructure and figuring out how to decouple the Java and OS release cycles. Anyway; with the 7u6 release we are finally completing the feature set by adding a desktop JRE and making it available for download on java.oracle.com and (in a week or so) on java.com.

With JDK 7u6 we are also adding a general-purpose port of the JDK (but not a desktop JRE) to Linux ARM, and making it available under the same licensing terms as Oracle Java for other platforms. This JDK release is aimed at the emerging ARM server market, and for the community working on development boards such as the BeagleBoard, PandaBoard and the Raspberry Pi. This port provides 32-bit binary for ARMv6 and v7, with full support for Swing/AWT, both client (C1) and server (C2) compilers and runs on most Linux distributions. One caveat is that the current binary is softfloat ABI only, so it won't work with (for example) the Raspbian distribution which uses the hardfloat ABI. We are planning to add hardfloat support in an upcoming JDK release, as well as support for JavaFX on ARM.

I anticipate quite a few questions about the ARM port, so here are a few FAQs to start with:

What is the relation between Java SE Embedded and the JDK for ARM? Java SE Embedded is a Java SE compliant runtime optimized for small footprint devices, available for multiple architectures including ARM v5/6/7, x86 and PPC. It is a product that Oracle licenses commercially for embedded use.
Is the ARM JDK free (gratis) or does it require a commercial license? Like all general-purpose JDK and JRE binaries, the ARM JDK is free for development and production use on general-purpose hardware, and can be redistributed for free with applications targeting a general-purpose computer. See the end-user license for the exact license grants & restrictions. To take a couple of examples, an ARM server deployed in your datacenter running Tomcat or Glassfish is general-purpose, as is a Raspberry Pi board when you use it like a PC. An industrial controller or a kiosk appliance is not general purpose, and both would require a commercial license.
Is the Oracle JDK port to ARM available in OpenJD K?No, and we are not planning on open sourcing it at this point.
I own a Raspberry Pi/BeagleBoard/PandaBoard. How do I get Java running on it? Make sure that you use a Linux distribution that uses the softfloat ABI, or a hardfloat ABI that has multi-arch support but not a distribution that only supports hardfloat (such as Raspbian), and then download and install the Oracle JDK on it.
Why is Oracle investing in an ARM port and then giving it away for free? We have a super-secret agenda. The idea is to enable Java developers so that Java can continue to thrive, and maybe sell some middleware on ARM servers down the line.
Is graphics fully supported? What about sound? Yes, the JDK binary is headful which means that Swing/AWT and sounds are both supported. Note that sound is not available in our headless Java SE Embedded binaries, which is the most likely reason for a small set of reports on sound issues found across the web. Swing/AWT requires X11R6 to work, framebuffer is not supported. JavaFX is not yet available on Linux ARM, but is in our roadmap.
Does the Linux ARM JDK have full feature parity with the JDK on other platforms? Most of the JDK features are supported, but there are some that are not available. Some examples of missing features include the G1 GC, tiered compilation and plugin/webstart. See the release notes for more detail. Some of these features will be added in future releases.
What is this softfloat vs hardfloat thing? When will the Oracle JDK support hardfloat? Some ARM chips have hardware support for floating point (hardfloat), and some do floating point through software (softfloat). An operating system running on an ARM chip that supports hardware floating point can use the floating point registers for parameter passing during function calls, which improves performance. This parameter passing is a contract between the OS, libraries and applications (such as the JVM) called the ABI or Application Binary Interface. In the simple case, an OS exposing the softfloat ABI requires all libraries and applications to be compiled against softfloat, and an OS exposing hardfloat requires libraries and applications to be compiled against hardfloat. There is a special case where a hardfloat OS can provide a compatibility layer and therefore enable softfloat applications to work. Until recently, almost all Linux distributions were softfloat. Lately, Linux distributions have aggressively moved to hardfloat. Some - I believe Ubuntu 12.04 is a good example - also provides softfloat compatibility. Raspbian on the other hand is hardfloat only. The initial release of the Oracle JDK for ARM uses the softfloat ABI and so works on softfloat distributions, or hardfloat with softfloat compatibility, but not on hardfloat. This is just a matter of timing - we will provide a hardfloat JDK at some point in the future. It will likely be done iteratively, so we may for instance deliver ARMv7 first and ARMv6 later, and the initial release may be headless so no Swing/AWT. We will produce public early access builds as soon as we are able and make them available on java.net. We don't have any dates to share yet, but will hopefully be able to provide a roadmap at JavaOne 2012.
Now that you have a public ARM port, will you support other OSes like iOS? Linux is a simple port, iOS is not. We have done some prototyping, but at this time it's not something we have on our roadmap. One of many open questions is what UI to use. JavaFX is an option, or a hybrid Java+Web combination like the one used for ADF mobile. It's really a matter of whether a solution would get sufficiently broad adoption to be worth the investment. If you want something NOW, head over to OpenJDK and start hacking! :-)
If I'm not an Oracle customer, how do I report an issue on the ARM JDK? Use the Java developer forums on OTN.
Good news me thinks :D


G

amigarulez
Posts: 42
Joined: Wed Jul 18, 2012 10:16 am

Re: Yay, Java JDK Coming for Raspberry Pi

Wed Aug 15, 2012 10:18 pm

Interesting comment about Raspbian, does Java have armhf issues just as Mono does?

JordanCClark
Posts: 3
Joined: Thu Apr 12, 2012 12:24 pm

Re: Yay, Java JDK Coming for Raspberry Pi

Thu Aug 16, 2012 9:34 am

Oracle blog wrote:Make sure that you use a Linux distribution that uses the softfloat ABI, or a hardfloat ABI that has multi-arch support but not a distribution that only supports hardfloat (such as Raspbian), and then download and install the Oracle JDK on it.
Judging by that, I'd say probably. But it looks like hardfloat-only support is coming, though. :mrgreen:

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Yay, Java JDK Coming for Raspberry Pi

Thu Aug 16, 2012 9:54 am

It is very interesting that a big company like Oracle is so aware of the Raspberry Pi and its Linux distributions.

The Raspberry Pi seems to be slap-bang in their focus for the ARM port, it's not being treated as just another random bit of hardware.

Andrepocalypse
Posts: 7
Joined: Sun Sep 02, 2012 7:16 am

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 8:00 am

I suppose many developers have been fascinated by the Raspberry Pi. It's not just for children now, it's for all the developers out there.

Plus it's £1000 cheaper than a mac ;)

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 11:24 am

I would like to point out that it is possible to install and run a armel JDK 7 on a armhf system by making use of the "multiarch" features found in the latest Debian/Ubuntu and possibly Raspbian systems. The main trick is to install all armel system libraries side by side of the armhf system libraries. The Oracle JVM can then run using the armel glibc.

The following guide describe the process on how to install the armel JDK 7 on a ubuntu 12.04 armhf system:
http://www.calxeda.com/trystack/gettingstarted/ - scroll down to 6) How do I install Oracle Java?

This looks good on paper for server type applications, you may still run into issues with JNI intense Java applications since then the armel JVM will try load system installed armhf librarys and that will still not work.


If you run into any issue then do use the openjdk-7-jdk package that is rock stable and fully armhf ready.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

Andrepocalypse
Posts: 7
Joined: Sun Sep 02, 2012 7:16 am

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 1:16 pm

xranby wrote:I would like to point out that it is possible to install and run a armel JDK 7 on a armhf system by making use of the "multiarch" features found in the latest Debian/Ubuntu and possibly Raspbian systems. The main trick is to install all armel system libraries side by side of the armhf system libraries. The Oracle JVM can then run using the armel glibc.

The following guide describe the process on how to install the armel JDK 7 on a ubuntu 12.04 armhf system:
http://www.calxeda.com/trystack/gettingstarted/ - scroll down to 6) How do I install Oracle Java?

This looks good on paper for server type applications, you may still run into issues with JNI intense Java applications since then the armel JVM will try load system installed armhf librarys and that will still not work.


If you run into any issue then do use the openjdk-7-jdk package that is rock stable and fully armhf ready.
Wouldn't that be quite slow with the pi, perhaps the wait wouldn't be too bad.

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 4:55 pm

Andrepocalypse wrote:
xranby wrote:...
If you run into any issue then do use the openjdk-7-jdk package that is rock stable and fully armhf ready.
Wouldn't that be quite slow with the pi, perhaps the wait wouldn't be too bad.
Java is already fast on the Pi using OpenJDK when care is applied to let the GPU handle graphics tasks and then let the fast interpreters and JITs running on the CPU take care of application logic. You can today use OpenGL ES 2 in combination with Java on the Pi to let the GPU take care of the heavy graphics lifting.

In order to make legacy AWT and Swing GUI applications fluid then care has to be taken to make sure that there exist a proper Java2D back-end that use the OpenGL ES 2 or OpenVG drivers on the Pi. By default OpenJDK and the Oracle JDK is heavily CPU driven and this is cause the primary bottleneck for Java GUI application responsiveness. Adding an improved JIT can only help GFX applications up to a degree. For GFX intense tasks it is mandatory to utilize the GPU in order to reach the best performance.

Similarly for Audio tasks where low latency is important it may make sense to check if there exist a good hardware accelerated pathway to for sound and audio processing. Try use JJack for a low latency event driven sound framework to be used by good sounding Pi Java applications.

For server type applications then do use the Oracle JDK JITs, they are really designed to excel in these kind of workloads and there is currently no FOSS project ongoing that aim to re-implement a similar Hotspot C1 and C2 JIT for ARM inside OpenJDK.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 10:13 pm

I'm just going to sit and wait for Oracle to release a hardfloat JDK and then I'll get on with looking at making LWJGL work. I can wait!

Cas :)

User avatar
jackokring
Posts: 816
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
Contact: ICQ

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Sep 03, 2012 11:10 pm

I wonder if there is enough memory to get frinika working?
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Fri Sep 21, 2012 12:33 pm

princec wrote:I'm just going to sit and wait for Oracle to release a hardfloat JDK and then I'll get on with looking at making LWJGL work. I can wait!

Cas :)
I am looking forward to see more hardware acceleration bridges like LWJGL and JavaFX Prism running on the Pi as well!

Do consider adding a common subset of the OpenGL 2 and OpenGL ES 2 API target to LWJGL so that the game code can run unmodified on both desktop and mobile using a common API. This is currently possible to do when using JogAmp JOGL hardware acceleration and multimedia bindings on the Raspberry Pi.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Fri Sep 21, 2012 2:11 pm

I do believe we've got a complete OpenGL ES 2 binding in LWJGL already but what you're asking is somewhat beyond the remit of what LWJGL seeks to provide which is a straight binding to native libraries.

For a retargetable graphics API, you would want to be looking at libgdx which does exactly that.

Cas :)

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Oct 08, 2012 8:45 pm

princec wrote:I do believe we've got a complete OpenGL ES 2 binding in LWJGL already but what you're asking is somewhat beyond the remit of what LWJGL seeks to provide which is a straight binding to native libraries.

For a retargetable graphics API, you would want to be looking at libgdx which does exactly that.

Cas :)
I have started a thread where i have added some information on how to port an OpenGL ES enabled version of the LWJGL library for the Raspberry Pi.
http://www.raspberrypi.org/phpBB3/viewt ... 63#p190363
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

princec
Posts: 31
Joined: Fri Sep 02, 2011 11:01 am
Contact: Website

Re: Yay, Java JDK Coming for Raspberry Pi

Mon Oct 08, 2012 9:08 pm

Nice one Xerces! Thanks for your support and help :)

Cas :)

Return to “Other programming languages”