Microcontroller with Java API

If you're inexperienced in the microprocessor/microcontroller programming field, you should probably learn C first, so that you can understand when and why Java is a poor choice for most microcontroller projects.

Did you read the restrictions on the JVM you linked? It includes the following problems:

  • As little as 512 bytes of program memory (not KB, and definitely not MB)
  • As little as 768 bytes of RAM (where your variables go. You're limited to 768 characters of strings by this restriction.)
  • About 20k Java opcodes per second on 8 Mhz AVR.
  • Only includes java.lang.Object, java.lang.System, java.io.PrintStream, java.lang.StringBuffer, a JVM control class, and a native IO class. You will not be able to do an import java.util.*; and get all the classes not in this list.

If you're not familiar with what these restrictions mean, make sure that you have a plan B if it turns out that you can't actually do the project with Java due to the space and speed restrictions.

If you still want to go with Java, perhaps because you expect the device to be programmed by a lot of people who only know Java, I'd strongly suggest getting bigger hardware, likely something that runs embedded Linux. See this page from Oracle for some specs to shoot for to run the embedded JVM, in the FAQ of their discussion they recommend a minimum of 32MB of RAM and 32MB of Flash. That's about 32,000 times the RAM and 1,0000 times the Flash of the AVR you're looking at. Oracle's Java Embedded Intro page goes into more detail about the restrictions of the JVM. Their tone of voice is, as you might guess, a good deal more Java-friendly than mine. Be aware that this kind of hardware is much more difficult to design than an 8-bit AVR.

I'm a computer engineering student with a computer science minor. My university's CS department has drunk the Java Kool-aid, so a lot of students in the engineering program come in knowing only Java (which is a sad state of affairs for a programmer, at least learn some Python or C++ if you don't want to learn C...), so one of my professors published a C Cheat Sheet (Wayback machine link) for students with a year of Java experience. It's only 75 pages; I suggest you read or skim it before making a decision. In my opinion, C is the most efficient, durable, and professional language in which to develop an embedded project.

Another alternative to consider is the Arduino framework. It uses a stripped down version of the Wiring language, which is like C++ without objects or headers. It can run on many AVR chips, it's definitely not restricted to their hardware. It will give you an easier learning curve than just jumping straight into C.

In conclusion,
XKCD Golden Hammer
Alt text: Took me five tries to find the right one, but I managed to salvage our night out--if not the boat--in the end.


The most popular programming environment for the Atmel AVR is Arduino. The Arduino language is a subset of C++.

Arduino "sketches"/programs appear syntactically very similar to Java. The Wiring language which Arduino derives from has implementations in C++ (Arduino), Java (Processing) and Javascript (processing.js).

Both languages share the same declaration style, loop constructs and arithmetic operators due to their common ancestry in Algol68. Typically, all objects in Arduino are declared globally or on the stack, so like Java, member functions are called with the . operator (eg. LED.flash()).

The language will be very familiar to a Java programmer - but, importantly, Arduino sketches are compiled into native code which runs at full speed with full hardware access. This is critical for getting the most from your microcontroller.

Here is the API.

Arduino provides everything you need to get going: low cost hardware, a free integrated development environment and a bootloader (so you can load code over USB/serial).


I want to make it clear that I haven't used one before, but there used to be one years ago called the Javelin. It's possible that Parallax has acquired them or something, because now the only one that comes up is the "Javelin Stamp". Years ago there also used to be a company called Velocity Semiconductor, that made a (supposedly) drop-in replacement for Rabbit Semiconductor's core modules, and it had a JVM in hardware, but that company has apparently vanished. Good luck in your search!