Embedded Toolbox: Shrinking Java to Raspberry Pi Sized

June 09, 2020

Video

 

Java is one of the most, if not the most, popular programming languages in the world. This is thanks to its incredible portability and an object-oriented, class-based paradigm that many believe makes software development simpler and more intuitive.

But over the last 25 years Java has gone from supporting just over 200 classes to more than 8,500 today. Of course no single application uses all of those classes, but the Java Runtime Environment must support them. For instance, a basic implementation of JDK 11 alone consumes a whopping 269 MB.

While this isn't an issue in server or desktop environments, that large a memory footprint is a non-starter in many embedded systems applications.

Still, the Internet of Things has accelerated demand for write once, run anywhere software that can be deployed on both servers and smart home gadgets. The portability of Java makes perfect sense in this context.

To bridge the gap between the resource constraints of embedded systems and the programming and portability of Java, Simon Ritter, Deputy CTO of Azul Systems joins this episode of Embedded Toolbox.

Using Azul's Zulu 11, an OpenJDK-based distribution of Java, Simon demonstrates how his company has compressed those 8,500-plus classes into 75 modules. He then shows how users can select which modules they need for their application and discard the rest to achieve a Java runtime that is an order of magnitude smaller (29 MB!!!) than the standard JDK.

For good measure, Simon shows his Java application in action on a Raspberry Pi. Using the open-source Pi4J project, he is able to abstract away the low-level complexities of I/O communication and control into a Java library so that he can write real-world accelerometer data from the Raspberry Pi into a database.

And the best part is, all of this small footprint, abstracted development took just a few minutes.

Tune in to learn how you can optimize Java for your embedded systems.

Featured Companies

Azul

1200 New Jersey Avenue, SE
Washington, DC