The OLPC and Java

I got an OLPC for the holiday season. No, it wasn't for the Horstmann twins—after all, it is one laptop per child, so the child must be myself. I got it through the “give one, get one program”. For $400, I got mine and a much more deserving kid somewhere out there got one as well. (Hurry if you want to get yours—the program ends today.)

Twelve years ago, in Chapter 1 of the first edition of Core Java, Gary Cornell and myself wrote this in the section entitled “Common Misperceptions about Java”:

With Java, I can replace my computer with a $500 “Internet appliance.”

Some people are betting big that this is going to happen. We believe it is pretty absurd to think that people are going to give up a powerful and convenient desktop for a limited machine with no local storage...We can envision an Internet appliance as a portable adjunct to a desktop. Provided the price is right, wouldn’t you rather have an Internet enabled telephone with a small screen to read your e-mail or see the news. Because the Java kernel is so small, Java is the obvious choice for such a telephone or other internet “appliance.”

So, now I have my $200 internet appliance. It works like a charm. I can browse the web and read my email. The keyboard is not great, but it is spillproof, which is just the thing when reading the news while the Horstmann twins are up to no good. Here is what I love about the OLPC:

But Gary and myself were wrong in one teensy detail. The internet appliance is not Java-powered. The OLPC uses Linux, and the browser is Firefox, converted to the kid-friendly “Sugar” environment.

I am not too thrilled about that part. I'd love to put more software onto the OLPC, but not if it means doing it in C++ and some goofball X11 window manager. I am glad that other people don't feel as squeamish about these things as I do, but it made me think about the role of Java in this new class of devices.

I really believe that the OLPC, the Asus Eee, and the Everex gPC, are the forerunners of a new category of devices that are truly useful and important. What would it take for Java to be an essential part of these devices?

First off, these are not crippled ME devices. I ran Java SE apps on the OLPC (see below for details), and the performance was ok for JEdit and the Violet UML editor. I didn't try Netbeans :-)

So, why didn't the OLPC folks put Java on the machine? A major reason is surely that Java was not open source software when the OLPC was designed.

Then there is the issue of SE bloat. Or maybe not. I thought about what parts of SE one could place into separate extension libraries. There is RMI/CORBA. And the sound stuff that very few people use because it isn't very good. What else? Maybe SQL, web services, scripting, NIO? Beyond that, I don't think one can drop entire packages. Some crypto is needed by platform security. Some XML is used by logging and preferences. Last Java One, I heard some people say that they were looking into this issue, and I am curious what they found. My hunch is that there may be a smallish core for console applications, but as soon as you let in Swing, you are probably at 2/3 of rt.jar.

Anyway, there has been this huge effort to make Java play nicely with Vista's throbbing buttons. Maybe that's yesterday's battle. The OLPC shows quite starkly what you can do for $200 if you dispense with those throbbing buttons and instead give people something more useful for a specific task—such as browsing the web around the house and in the garden. I once read that when electric motors were first sold, they were expensive high-tech equipment. People would buy one motor that could be attached to various devices. Maybe one day people will chuckle when they hear about the personal computer era when we bought one computer to run all sorts of programs on a single device.

This appendix contains the gory details—skip it if you don't have an OLPC.

To install Java, go to a non-XO machine and visit

Download "Linux RPM (self-extracting file)". Use scp or a USB stick to move to the XO. On the XO, run

chmod a+x jre-6u3-linux-i586-rpm.bin 

(The exact name may differ.)

By the way, here is the result of running df before

mtd0 1048576 346408 702168 34% /

and after

mtd0 1048576 428820 619756 41% /

On another computer, use ssh -X to get a shell on the XO. (If you use Cygwin, be sure to have X11 installed.) Try running a Web Start program:


If you get an error message such as

java.lang.UnsatisfiedLinkError: /usr/java/jre1.6.0_03/lib/i386/ cannot open shared object file: No such file or directory

then run

yum install compat-libstdc++-33

You should now be able run Java applications and have them show up on your other computer.

Unfortunately, on the XO itself, the Matchbox window manager seriously breaks Java applications. JEdit shows up, but the main window is too small and the menus and dialogs are at the wrong places. Violet doesn't seem to work at all. This will presumably get worked on in the future.

I then tried to get the Java Plug-in working in the usual way:

cd /usr/lib/mozilla/plugins/
ln -s /usr/java/jre1.6.0_03/plugin/i386/ns7/

Unfortunately, the plug-in didn't show up when visiting about:plugins

I got these errors in /home/olpc/.sugar/default/logs/org.laptop.WebActivity?-1.log

LoadPlugin: failed to initialize shared library [ cannot open shared object file: No such file or directory]
LoadPlugin: failed to initialize shared library [ cannot open shared object file: No such file or directory]
LoadPlugin: failed to initialize shared library /usr/java/jre1.6.0_03/plugin/i386/ns7/ [/usr/java/jre1.6.0_03/plugin/i386/ns7/ undefined symbol: _ZTVN10__cxxabiv121__vmi_class_type_infoE]

I got rid of the first two error messages by making symlinks /usr/lib/ -> and /usr/lib/ ->

But the third message persisted. Apparently, I am not the only onewith this problem, but I could not find a solution. (Setting JAVA_HOME in /etc/profile didn't help.)

Just to make it very clear—do not buy an OLPC today to run Java applications. My experiment demonstrates that the machine has sufficient power to do so, but the software needs work.