Java, Equinox and EclipseRT on the Raspberry Pi

Earlier this week I ordered a Raspberry Pi and it arrived today.

raspberry pi Java, Equinox and EclipseRT on the Raspberry Pi

For those of you who haven’t heard of the Raspberry Pi, it’s a low cost computer that includes HDMI (1080p) output, USB, Ethernet, an ARM processor (700Mhz) and 512Mb (or 256Mb) of RAM. The entire computer is the size of a credit card (or an Ontario Fishing License if you prefer), and can be purchased for as little as $25 ($35 for the 512Mb version). The board also includes 26 pins, allowing you to connect it to all sorts of crazy hardware — treating the little computer more like an embedded controller.

Backing up a decade, OSGi (the underlying modularity system used for Eclipse) was originally designed for embedded systems such as set-top boxes. The EclipseRT (Runtime Project) extended this work by bringing high quality runtime components to this programming model. EclipseRT includes components such as: a powerful webserver (Jetty), a provisioning platform (p2), persistence technology (EclipseLink), a rich widget toolkit for Ajax based applications (RAP), and more. The idea that you could create a full software stack based on Eclipse and deploy it on a stick has been on our minds for years, but a we lacked a low cost (and generally available) computing platform to deploy it too. With a Raspberry Pi in hand, I decided to revisit this vision.

The Setup

To get started, you need an OS and a JVM. There is a Debian based distribution for the Raspberry Pi (Raspbian) and Oracle has a JVM for the ARM processor. Unfortunately the most common setup doesn’t work. The Oracle JVM does not support the hard-float ABI used by Raspbian. Lucky for us, there is a Raspbain image that supports soft-float ABI. Download this image and write it to an SD card (there are several good tutorials out there on how to do this). Once the image is on the card, you can start your Pi and install the JVM.

Screen Shot 2013 05 01 at 9.01.16 PM Java, Equinox and EclipseRT on the Raspberry Pi
 The RT Stack

The application I used was a simple web based mail client that leverages RAP (for the widgets) Jetty (for the webserver), Apache Felix Gogo shell, and Equinox. The entire application was designed as an  ’Eclipse Product’ and built with Tycho. Because Raspberry Pi is not a supported architecture, we targeted Linux/x86 (knowing full well that no native libraries would work). Once the build was completed, the product was copied to the Pi.

Screen Shot 2013 05 01 at 9.12.07 PM Java, Equinox and EclipseRT on the Raspberry Pi
The Launch

The launchers that you get when you build a product are native, that is, binary executables for the particular platform. Because Raspberry Pi is not a support platform (yet), you cannot use the native launcher. Instead, you need to start your product by invoking Java and specifying the launcher jar.

Screen Shot 2013 05 01 at 9.23.23 PM Java, Equinox and EclipseRT on the Raspberry Pi

 The Result

With the runtime stack and mail application running on the Raspberry Pi, testing the setup is as simple as navigating to the Pi with a web browser.

Screen Shot 2013 05 01 at 9.25.54 PM Java, Equinox and EclipseRT on the Raspberry Pi

While this is just an example, it does show that you can get a non-trivial OSGi application (46 bundles) running on a Raspberry Pi without much work. It also opens the door to a large collection of Eclipse based runtimes (including the modelling technologies, ECF and more) running on the Pi. Having the EclipseRT projects running on a Pi is a great addition to the other M2M (Machine-to-Machine) work that is happening at Eclipse.org.

For more information on what I’m doing with Eclipse, Equinox, p2 and the Raspberry Pi, feel free to follow me on Twitter (@irbull).

6 Responses to “Java, Equinox and EclipseRT on the Raspberry Pi”

  1. Kai Tödter says:

    Thx Ian, great blog! I think I want a Raspberry PI right now :)

  2. Xavier says:

    Hello,

    You can find a hard float version of oracle jdk8 here : https://jdk8.java.net/fxarmpreview/index.html

    Regards,

    Xavier

  3. Bryan Hunt says:

    I’ve also been playing with OSGi on the Raspberry Pi. You can also use the latest Java 8 build and it supports hard-float. I personally don’t use the launcher. You can launch the framework by simply: java -jar org.eclipse.osgi_3.9.0.v20130410-1557.jar. You have to do a bit more work to get the console running, but you can then minimize the number of bundles you are loading.

  4. Kai Kreuzer says:

    Hi Ian, you might find interesting that we are running openHAB already since end of last year successfully on a Raspberry Pi – see https://code.google.com/p/openhab/wiki/HardwareFAQ. openHAB is a M2M / home automation application based on EclipseRT.

  5. James Stansell says:

    Doesn’t raspbian have the OpenJDK (icedtea) packages available in the repository?

  6. Ian Bull says:

    @James

    apt-cache search told me it did, but when I tried to install it, it failed — mostly with 404s. I decided to download the OracleVM instead of digging into the reasons for the failures, but thanks for the reminder; I think I’ll revisit this approach too.

6 responses so far

Written by . Published in Categories: EclipseSource News, Editors choice, Planet Eclipse, Planet OSGi

Author:
Published:
May 2nd, 2013
Follow:

Twitter LinkedIn Google+ GitHub