raspberry pi and java 8

March 27, 2014

What you’re looking at is the SwingSet2 demo, something rather old now, running via the latest Java release, Java 8 on my Raspberry Pi, on the twm desktop and on top of the latest Arch Linux for ARM. What a mouthful…

It’s been almost a month now since my last Raspberry Pi post; I was on a business trip in Kansas for three weeks. During that period of time Oracle released Java 8 on 18 March. One of the Java implementations was for ARM V6, compiled for hard float (chip-supported floating point math). As a test I also dropped the demo package on my RPi and fired up one of the demos. To be honest it was slow starting, but not horribly slow. It was slow like my computers from a good decade ago, the ones running early Pentium chips (back when Intel still called their chips Pentiums). I don’t intend to run graphical Java applications as much as service type applications.

I’m looking at Java 8 to run JavaScript via Java 8’s built-in JavaScript engine, Nashorn. The key reason is not to abandon node.js, but to shift the JavaScript portion (if possible) to run on Nashorn as apposed to Google’s V8. There are a number of reasons for doing this, one of which is security; I believe Java 8 has far more than V8. Before you bust a gasket telling me about Java’s security sins, know that the vector for Java security breaches was with older versions of Java using applets. That’s not what we’re about here. A second key reason is that I can call down into the Java libraries via JavaScript. And I can investigate manipulating the RPi’s various I/O devices via Java 8.

I don’t know when I’ll release a new image. Compressed, my 8GB images are now at 1GB, which makes it a chore to upload them, and I’m sure a chore for you to download. Although I’ve seen downloads from Sourceforge, they’ve pretty much dried up. I may make an image with Java 8 available on April 1, like I had originally intended. It’ll have Arch Linux fully up to date as well as Java 8.

For now tax season looms and other work is making my life very busy. I’ve got another two week business trip coming up, and more business travel after that. It’s a long busy stretch ahead.

Update


I installed Apache ant and built one of the sample applications, Scriptpad. In this simple example JavaScript is calling Java’s JFrame class and instantiating a running instance with a simple title. It took all of five lines of JavaScript to invoke a Java class instance. Not too shabby. This is, of course, just a trivial proof of concept. But it does illustrate the power of the JVM.