Published in


Book introduction: “Getting Started with Java on Raspberry Pi”

Early 2019 I started experimenting with Java and JavaFX 11 on the Raspberry Pi. My goal was to develop a touch screen controller for the drum booth of my son to control some LED strips and other lights with a relays-board.

I had to research and learn a lot and started blogging and writing about this process, which resulted in … a book!

Java SDK on Raspberry Pi

At the start of this project, Raspbian OS included Java SDK 8 and I first needed to find the correct SDK for the Raspberry Pi. When you start now, it’s already a lot easier as Raspbian OS got upgraded to Java 11, but you still need some additional steps to be able to use JavaFX as I also described in this Medium post: “Installing Java JDK with JavaFX on the Raspberry Pi”.


As any good coding-experiment starts with a HelloWorld application, for hardware projects it’s a blinking LED. Being able to do so with Java and a JavaFX button on the Raspberry Pi was my first magic moment. No rocket science of course, but still you need to understand how the pins of the Raspberry Pi work and how you can control them with Java code.

The book

As I do love to write, I described every step in an ebook “Getting Started with Java on the Raspberry Pi” on LeanPub, which is now also available in a paper version in the Elektor shop.

You can find a lot of info on Java, JavaFX and the Raspberry Pi in this book, all illustrated with simple examples. No full programs as these are all “building blocks” you can use and combine into the application you want to build.

Some of the topics:

  • A crash course for Java and Linux commands.
  • How to install and use Maven to build your application.
  • How to read and use bits and bytes and the difference between signed and unsigned values in Java. Illustrated with a led number display example.
  • Build a user interfaces with JavaFX to interact with the hardware.
  • Using the Pi4J framework and dependency to control LED's, buttons, displays, led strips, relays boards and more.
  • Build a Spring application to interact with your Pi via web interfaces (REST) and store sensor data in a database.
  • Setting up a queue on a Raspberry Pi to send and receive messages from Arduino boards, PC’s and other Raspberry Pi’s.
  • A lot of other examples to start your own do-it-yourself project.
  • Tips and tricks to become or be a better developer.
  • Interviews with some of my Java-heroes: Karen Mouws (STEM and diversity), Trisha Gee (IntelliJ IDEA), Xiaokai He (Visual Studio Code), Alexander Belokrylov (BellSoft Liberica JDK), Jakob Jenkov (Java and, Johan Vos (OpenJFX, JavaFX and GluonHQ), Gerrit Grunwald (Java, JavaFX, TilesFX), Mark Heckler (Spring, Pivotal), Vlad Mihalcea (JPA, Hibernate).

Even if you are an experienced Java developer, but want to get started with hardware experiments, this book will give you new insights and help you to build your first electronics projects.

Cover of the ebook and paper book “Getting Started with Java on Raspberry Pi”

The sources

All the example code, scripts, links to additional info… are available in this JavaOnRaspberryPi project on GitHub. Check my blog for some posts based on examples of the book and more Java and Raspberry Pi fun!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store