Embedded Toolbox: Shrinking Java to Raspberry Pi Sized

June 9, 2020 Brandon Lewis

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.

About the Author

Brandon Lewis

Brandon Lewis, Editor-in-Chief of Embedded Computing Design, is responsible for guiding the property's content strategy, editorial direction, and engineering community engagement, which includes IoT Design, Automotive Embedded Systems, the Power Page, Industrial AI & Machine Learning, and other publications. As an experienced technical journalist, editor, and reporter with an aptitude for identifying key technologies, products, and market trends in the embedded technology sector, he enjoys covering topics that range from development kits and tools to cyber security and technology business models. Brandon received a BA in English Literature from Arizona State University, where he graduated cum laude. He can be reached by email at brandon.lewis@opensysmedia.com.

Follow on Twitter Follow on Linkedin Visit Website More Content by Brandon Lewis
Previous Article
Dev Kit Weekly – Microchip Hello FPGA Kit
Dev Kit Weekly – Microchip Hello FPGA Kit

Don’t know AI? Even less familiar with FPGAs? Well don’t worry, because this week on Dev Kit Weekly we’re g...

Next Article
Dev Kit Weekly: Microchip AVR-BLE Development Board
Dev Kit Weekly: Microchip AVR-BLE Development Board

In this edition of Dev Kit Weekly, Perry breaks down the AVR-BLE Development Board from Microchip.