Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Pi4J Welcomes Java 21 on the Raspberry Pi

  • February 20, 2025
  • 3374 Unique Views
  • 2 min read

Pi4J provides a friendly object-oriented I/O API and implementation libraries for Java Programmers to access the full I/O capabilities of the Raspberry Pi platform.

The project "hides" the complexity to interact with electronic components through different ways of communication (SPI, I2C, PWM,...) by providing Java interfaces on top of native libraries that can interact with the GPIO (General Purpose Input/Output) pins on the Raspberry Pi.

Recently, the development of the Pi4J library faced a decision point: "Should we stick to Java 11 for existing projects and old Raspberry Pi's (with ARMv6), versus moving on and making use of better and more performant Java code with the latest Long Term Support (LTS) version?"

We actually wanted to move on to Java 22, as it brings a new way of interacting with C-code, thanks to JEP 454: Foreign Function & Memory API. As this is the core behavior of Pi4J to interact with the GPIOs, it would make it much easier to implement new ways to control electronics, as confirmed with a first test by Robert "Eitch" von Burg. But as Java 22 is not an LTS release, we won't make this move yet.

We asked our users which minimal Java version we should use, but there was no one clear answer, as expected 😉 So with the core team we made a few decisions that are allowing us to bring the project to "the next level" and... Java 21!.

  • We renamed the repository with the sources of Pi4J V2+ from pi4j-v2 to pi4j as it holds the sources of all V2 and future V3, V4,... versions.
  • The minimal supported Java version for future releases (V3.X.X) is 21.
  • When the next LTS becomes available, we can easily bump again (to V4?).
  • When critical bugs are found, we can still backport them to V2 and make a new release. This is also used in the OpenJDK development, as described in JEP 14: The Tip & Tail Model of Library Development.
  • This documentation website was reviewed:
    • To have the correct links to the renamed repository.
    • Make it clear that V1 is deprecated and a separate repository.
    • V2, V3, and future versions are based on the same repository.
  • With this bump to Java 21, we are also preparing to more easily bump to the next LTS, which will be Java 25 in September 2025.
  • Bumping to the latest LTS makes it possible to make use of many newer Java language and runtime improvements, simplify some of the code, etc.

3.0.0-SNAPSHOT of Pi4J is already available for testing from the Maven Repository if you enable snapshots in your pom-file. See Pi4J Downloads > Snapshot Archives for more info.

More info about V3 will be documented on the page What's New in V3.

Interviews with Robert Savage and Johan Vos on the State of Java on Raspberry Pi

Here on Foojay.io, you can find already a long list of articles about Java on the Raspberry Pi.

As you may know, already I’m a big fan of this combination. The Raspberry Pi on one side is a very cheap computer that allows you to experiment with electronic components thanks to the Pi4J library.

And on the other hand, JavaFX is the ideal framework to build user interfaces that can directly control these components, all in one application!

But maybe you don’t have / want to believe me? So let’s ask two experts what they think is the future of #JavaOnRaspberryPi.

Java 17 on the Raspberry Pi

As part of the Foojay Virtual OpenJDK 17+ JUG Tour, I was asked to present the state of Java and JavaFX 17 on the Raspberry Pi.

So, a perfect opportunity to freshen up my #JavaOnRaspberryPi presentation with some hot-off-the-press versions.

Java on Raspberry Pi 5 with Pi4J

Alexander Liggesmeyer contributed a new plugin to Pi4J: GpioDPlugin. As a Pi4J-user, he wanted to run his applications on the Raspberry Pi 5.

Unlocking Java Secrets with Frank Delporte: Insights, Stories, and Tips for Success

Dive into our insightful interview with Frank Delporte, Java Champion and Senior Technical Writer at Azul Systems, as he shares his experiences in the software industry.

Template to Get Started with Pi4J and JavaFX on Raspberry Pi

How to use the same architecture to implement a JavaFX-based GUI, a PUI attached to a Raspberry Pi, and integrate both in a clean, modular way.

Do you want your ad here?

Contact us to get your ad seen by thousands of users every day!

[email protected]

Comments (0)

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

No comments yet. Be the first.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard