Background to Oracle v Android tagged: , ,

Background to Oracle v Android

Posted by in Android, J2ME

You may have read about Oracle’s legal action against Google, over Google’s use of non-standard Java for its Android OS. Like me, some of you might not have known what all the fuss is about. Here I’ll share with you what I’ve learnt about the current state of affairs with Java and Mobile Java in particular.

What’s up with Java and this thing called Harmony?

Before Sun decided to open source Java, the Open Source community, in the form of Apache and IBM, created an open version of Java called Apache Harmony. This was a completly clean implementation of the Java spec, in Java/C++.

Sun did eventually open source Java, but rather than donate the code to Harmony and give it an Apache license, Sun decided to release it under the GPL in the form of OpenJDK. Why does that matter, it’s all open any way, you may ask. Well firstly, the GPL and Apache licenses are incompatible. Secondly, Java may be open source, but a critical part of the Java standard has not been opened up. This part is the Technology Compatibility Kits (TCKs). TCKs are used for checking whether an implementation of Java conforms to the Java spec. Sun kept these closed to keep some semblance of control over Java (it had this, and a veto in the JCP). Typically the TCKs are licensed — for a fee and/or under strict conditions — to parties that need to test an implementation of Java.

Being closed in this way, Apache could not use the TCK to verify that Harmony meets the specifications. In particular, this was because of conditions in the TCK license that limited the “field of use” for the implementation. It was obvious, therefore, that in the parts that really matter Java was still closed and Sun remained in control. When Oracle bought Sun there was hope that things would change and the TCKs would be opened. This was not to be. Oracle has maintained a tight grip on the TCKs and promoted OpenJDK over the renegade Apache Harmony.

What does this have to do with Android?

When the Android platform was being developed, Google chose Java as the development language. A choice was also made to bypass JavaME, which is hopelessly underpowered for modern smartphones. In addition they sidestepped OpenJDK, I assume because of the TCK license issues. Instead, Android chose to use Apache Harmony. Well, almost, but not quite. They chose the Dalvik JVM, which implements a subset of Apache Harmony and uses some different class libraries. It’s important to note at this point that the Dalvik JVM will not run standard Java classes. Apart from being a subset of the Java Spec, the Dalvik bytecode is also different. I’m trying to emphasize that the two are differnt in many ways, despite both being Java.

So far so good…Android is released, it’s a big success and everyone is happy. Except Oracle. They feel they’ve been shafted. JavaME is losing developers to Android and iPhone (this is mostly Sun/Oracle’s own fault!), and what’s more, Android didn’t even have the scrupals to use Oracle’s version of Java… the official version. Instead Android rejected OpenJDK in favour of Harmony — an ironic name for something sewing such discord.

So here we are, Oracle is suing Google for not using Oracle’s technology properly. Google, Apache and many Open Sourcers are shouting that Oracle needs to open up Java and change things, not attack great open source projects like Harmony and Android. So who will win? Noone knows, but the latest news is that IBM, once a staunch supporter of Harmony, has decided to jump ship over to OpenJDK. That leaves only Apache and Google to fight for the right to use open Java. 

Keep watching this space. Things will be further complicated as we see Java 7 in 2011 and eventually Java 8. Open source devotees are threatening to hold this up if Java stays closed at heart.