{"id":46464,"date":"2021-09-25T13:56:53","date_gmt":"2021-09-25T13:56:53","guid":{"rendered":"https:\/\/foojay.io\/?p=46464"},"modified":"2024-02-06T12:18:16","modified_gmt":"2024-02-06T12:18:16","slug":"java-17-on-the-raspberry-pi","status":"publish","type":"post","link":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/","title":{"rendered":"Java 17 on the Raspberry Pi"},"content":{"rendered":"\n    <div class=\"article__table\">\n        <div class=\"article__table-header\">\n            <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path d=\"M8 6H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M8 12H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M8 18H21\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 6H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 12H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n                <path d=\"M3 18H3.01\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" \/>\n            <\/svg>\n            Table of Contents\n            <svg class=\"chevron\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                <path d=\"M18 15L12 9L6 15\" stroke=\"#3562E5\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/>\n            <\/svg>\n        <\/div>\n        <div class=\"article__table-body\"><ul><li><a href=\"#h3-0--etup-a-ew-aspberry-i-with-64bit-\">Setup a New Raspberry Pi with 64bit OS<\/a><\/li><li><a href=\"#h3-1--\">SDKMAN<\/a><\/li><li><a href=\"#h3-2--arly-ccess-ava-17\">Early Access Java 17<\/a><\/li><li><a href=\"#h3-3--isual-tudio-ode\">Visual Studio Code<\/a><\/li><\/ul><span><a href=\"#h2-4--un-a-i4-project\">Run a Pi4J project<\/a><\/span><span><a href=\"#h2-5--onclusion\">Conclusion<\/a><\/span><\/div><\/div><!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><p>As part of the <a href=\"https:\/\/foojay.io\/today\/schedule-for-foojay-virtual-openjdk-17-jug-tour\/\">Foojay Virtual OpenJDK 17+ JUG Tour<\/a>, I was asked to present the state of Java and JavaFX 17 on the Raspberry Pi. <\/p>\n\n\n\n<p class=\"has-text-align-center\"><div class=\"homepage-today__guide homepage-today__guide--w-image\"\n     data-entry=\"105890\"\n     data-current=\"46464\"\n     style=\"border-color:#EEE8E3;color:#000000\"\n    >\n    <div class=\"homepage-today__guide-title-container\">\n        <div class=\"homepage-today__guide-label\">Sponsored Content<\/div>                    <h2 class=\"homepage-today__guide-title\">Jakarta EE 11: Beyond the Era of Java EE<\/h2>\n                <p class=\"homepage-today__guide-description\">\n            This user guide provides a brief history of Java EE\/Jakarta EE and a detailed overview of some of the specifications that will be updated in Jakarta EE 11.        <\/p>\n\t                <a href=\"https:\/\/www.payara.fish\/resource\/jakarta-ee-11-beyond-the-era-of-java-ee\/?utm_campaign=Foojay%202024&amp;utm_source=FooJay&amp;utm_medium=Jakarta11\"\n               target=\"_blank\"\n               class=\"homepage-today__guide-btn\"\n                >\n                Get Started                <svg\n                        xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n                        width=\"16\"\n                        height=\"16\"\n                        viewBox=\"0 0 16 16\"\n                        fill=\"none\"\n                >\n                    <path\n                            d=\"M3.33325 8H12.6666\"\n                            stroke=\"white\"\n                            stroke-width=\"1.5\"\n                            stroke-linecap=\"round\"\n                            stroke-linejoin=\"round\"\n                    \/>\n                    <path\n                            d=\"M8 3.33331L12.6667 7.99998L8 12.6666\"\n                            stroke=\"white\"\n                            stroke-width=\"1.5\"\n                            stroke-linecap=\"round\"\n                            stroke-linejoin=\"round\"\n                    \/>\n                <\/svg>\n            <\/a>\n            <\/div>\n    <div class=\"homepage-today__guide-img-container\">\n        <img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"314\" src=\"https:\/\/foojay.io\/wp-content\/uploads\/2024\/02\/payara-ad-700x314.png\" class=\"attachment-medium size-medium wp-post-image\" alt=\"\" srcset=\"https:\/\/foojay.io\/wp-content\/uploads\/2024\/02\/payara-ad-700x314.png 700w, https:\/\/foojay.io\/wp-content\/uploads\/2024\/02\/payara-ad.png 714w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/>    <\/div>\n<\/div>\n <\/p>\n\n\n\n<p>So, a perfect opportunity to freshen up my <a target=\"_blank\" href=\"https:\/\/twitter.com\/hashtag\/JavaOnRaspberryPi\">#JavaOnRaspberryPi<\/a> presentation with some hot-off-the-press versions.<\/p>\n\n\n\n<p><em><strong>UPDATE 2021-08-30: the recording of the presentation has been published on YouTube.<\/strong><\/em><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Current state of Java, JavaFX, and Pi4J on the Raspberry Pi - Frank Delporte\" width=\"500\" height=\"375\" src=\"https:\/\/www.youtube.com\/embed\/m4mP140npqc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>In the past, I have been experimenting with Java 16 on the Raspberry Pi (see \"<a href=\"https:\/\/foojay.io\/today\/building-openjdk-from-github-sources-on-64-bit-raspberry-pi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Building OpenJDK from GitHub Sources on 64-bit Raspberry Pi<\/a>\") but now that version 17 is waiting around the corner, it's time to prepare our Raspberry Pi for the upcoming new \"long-term-supported\" (LTS) version.<\/p>\n\n\n\n<p>To be able to easily test and install different Java versions, I love using <a href=\"https:\/\/sdkman.io\/install\" target=\"_blank\" rel=\"noopener\">SDKMAN<\/a> but unfortunately this isn't available for 32bit systems. So, no problem, we start with a fresh Raspberry Pi and the 64bit OS version!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h3-0--etup-a-ew-aspberry-i-with-64bit-\">Setup a New Raspberry Pi with 64bit OS<\/h3>\n\n\n\n<p>Although the 64bit version is still not officially released at the time of writing (as described earlier in \"<a href=\"https:\/\/foojay.io\/today\/64-bit-raspbian-os-on-raspberry-pi-4-with-usb-boot\/\" target=\"_blank\" rel=\"noopener\">Faster &amp; More Reliable 64-bit OS on Raspberry Pi 4 with USB Boot<\/a>\"), there is a more regular updated version available on the <a href=\"http:\/\/downloads.raspberrypi.org\" target=\"_blank\" rel=\"noopener\">download server of the Raspberry Pi Foundation<\/a>. <\/p>\n\n\n\n<p>For this post, I used the <code>\/raspios_arm64\/images\/<\/code> version of 2021-05-28 and \"burned\" it on a USB Flash Drive with the <a href=\"https:\/\/www.raspberrypi.org\/software\/\" target=\"_blank\" rel=\"noopener\">Raspberry Pi Imager tool<\/a>. This is a Desktop version of Debian 10 customized for the Raspberry Pi, with minimal extra tools pre-installed. The full version with Java 11 and extra programs, is only available as a 32bit version in <code>\/raspios_full_armhf\/<\/code>. <\/p>\n\n\n\n<p>After booting we can check the version in the terminal:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ lsb_release -d\nDescription:\tDebian GNU\/Linux 10 (buster)\n$ uname -a\nLinux raspberrypi 5.10.17-v8+ #1414 SMP PREEMPT Fri Apr 30 13:23:25 BST 2021 aarch64 GNU\/Linux<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h3-1--\">SDKMAN<\/h3>\n\n\n\n<p><a href=\"https:\/\/sdkman.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">SDKMAN<\/a> is very useful tool to quickly install a new Java version, or switch between already installed versions. With a few terminal commands, we can install it on our Raspberry Pi.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt install zip\n$ curl -s \"https:\/\/get.sdkman.io\" | bash\n$ source \"$HOME\/.sdkman\/bin\/sdkman-init.sh\"\n$ sdk version\n==== BROADCAST =================================================================\n* 2021-08-20: gradle 6.9.1 available on SDKMAN!\n* 2021-08-19: springboot 2.5.4 available on SDKMAN!\n* 2021-08-19: springboot 2.4.10 available on SDKMAN!\n================================================================================\n\nSDKMAN 5.12.2\n<\/pre>\n\n\n\n<p>OK nice, we have SDKMAN running on the Raspberry Pi now! There is an impressive list of Java editions you can install! This is the list on 23th of September 2021 you get with the command <code>sdk list java<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">================================================================================\nAvailable Java Versions\n================================================================================\n Vendor        | Use | Version      | Dist    | Status     | Identifier\n--------------------------------------------------------------------------------\n AdoptOpenJDK  |     | 16.0.1.hs    | adpt    |            | 16.0.1.hs-adpt      \n               |     | 11.0.11.j9   | adpt    |            | 11.0.11.j9-adpt     \n               |     | 11.0.11.hs   | adpt    |            | 11.0.11.hs-adpt     \n               |     | 8.0.292.j9   | adpt    |            | 8.0.292.j9-adpt     \n               |     | 8.0.292.hs   | adpt    |            | 8.0.292.hs-adpt     \n               |     | 8.0.275+1.hs | adpt    |            | 8.0.275+1.hs-adpt   \n               |     | 8.0.252.hs   | adpt    |            | 8.0.252.hs-adpt     \n Corretto      |     | 17.0.0.35.1  | amzn    |            | 17.0.0.35.1-amzn    \n               |     | 16.0.2.7.1   | amzn    |            | 16.0.2.7.1-amzn     \n               |     | 11.0.12.7.1  | amzn    |            | 11.0.12.7.1-amzn    \n               |     | 8.302.08.1   | amzn    |            | 8.302.08.1-amzn     \n               |     | 8.0.262      | amzn    |            | 8.0.262-amzn        \n Dragonwell    |     | 11.0.9.4     | albba   |            | 11.0.9.4-albba      \n GraalVM       |     | 21.2.0.r16   | grl     |            | 21.2.0.r16-grl      \n               |     | 21.2.0.r11   | grl     |            | 21.2.0.r11-grl      \n Java.net      |     | 18.ea.15     | open    |            | 18.ea.15-open       \n               |     | 18.ea.2.lm   | open    |            | 18.ea.2.lm-open     \n               |     | 17           | open    |            | 17-open             \n               |     | 16.0.2       | open    |            | 16.0.2-open         \n               |     | 11.0.12      | open    |            | 11.0.12-open        \n               |     | 11.0.11      | open    |            | 11.0.11-open        \n               |     | 11.0.10      | open    |            | 11.0.10-open        \n               |     | 8.0.302      | open    |            | 8.0.302-open        \n               |     | 8.0.292      | open    |            | 8.0.292-open        \n Liberica      |     | 17.0.0.fx    | librca  |            | 17.0.0.fx-librca    \n               |     | 17.0.0       | librca  |            | 17.0.0-librca       \n               |     | 16.0.2.fx    | librca  |            | 16.0.2.fx-librca    \n               |     | 16.0.2       | librca  |            | 16.0.2-librca       \n               |     | 11.0.12.fx   | librca  |            | 11.0.12.fx-librca   \n               |     | 11.0.12      | librca  |            | 11.0.12-librca      \n               |     | 8.0.302      | librca  |            | 8.0.302-librca      \n Liberica NIK  |     | 21.2         | nik     |            | 21.2-nik            \n               |     | 21.1         | nik     |            | 21.1-nik            \n               |     | 21.0.0.2     | nik     |            | 21.0.0.2-nik        \n Microsoft     |     | 16.0.2.7.1   | ms      |            | 16.0.2.7.1-ms       \n               |     | 11.0.12.7.1  | ms      |            | 11.0.12.7.1-ms      \n Oracle        |     | 17           | oracle  |            | 17-oracle           \n SapMachine    |     | 17           | sapmchn |            | 17-sapmchn          \n               |     | 16.0.2       | sapmchn |            | 16.0.2-sapmchn      \n               |     | 11.0.12      | sapmchn |            | 11.0.12-sapmchn     \n Semeru        |     | 16.0.2       | sem     |            | 16.0.2-sem          \n               |     | 11.0.12      | sem     |            | 11.0.12-sem         \n               |     | 8.0.302      | sem     |            | 8.0.302-sem         \n Temurin       |     | 17.0.0       | tem     |            | 17.0.0-tem          \n               |     | 16.0.2       | tem     |            | 16.0.2-tem          \n               |     | 11.0.12      | tem     |            | 11.0.12-tem         \n               |     | 8.0.302      | tem     |            | 8.0.302-tem         \n Zulu          |     | 17.0.0       | zulu    |            | 17.0.0-zulu         \n               |     | 16.0.2       | zulu    |            | 16.0.2-zulu         \n               |     | 11.0.12      | zulu    |            | 11.0.12-zulu        \n               |     | 8.0.302      | zulu    |            | 8.0.302-zulu        \n================================================================================\nUse the Identifier for installation:\n\n    $ sdk install java 11.0.3.hs-adpt\n================================================================================<\/pre>\n\n\n\n<p>Let's install the Temurin version 17 provided by <a href=\"https:\/\/adoptium.net\" target=\"_blank\" rel=\"noreferrer noopener\">adoptium.net<\/a> (formerly known as adoptopenjdk.net).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pi@raspberrypi:~ $ java -version\nopenjdk version \"11.0.12\" 2021-07-20\nOpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2deb10u1)\nOpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2deb10u1, mixed mode)\n\npi@raspberrypi:~ $ sdk install java 17.0.0-tem\n\nDownloading: java 17.0.0-tem\n...\nInstalling: java 17.0.0-tem\nDone installing!\nSetting java 17.0.0-tem as default.\n\npi@raspberrypi:~ $ java -version\nopenjdk version \"17\" 2021-09-14\nOpenJDK Runtime Environment Temurin-17+35 (build 17+35)\nOpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)\n<\/pre>\n\n\n\n<p>Indeed <code>sdk install java 17.0.0-tem<\/code> is all that's needed to switch to Java 17!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h3-2--arly-ccess-ava-17\">Early Access Java 17<\/h3>\n\n\n\n<p>As no official Java 17 is available at the time this article was written, an other approach is to install an early access version provided by jdk.java.net. At 23th of August an EA-version was available and could be installed based on <a href=\"https:\/\/opensource.com\/article\/19\/11\/install-java-linux\" target=\"_blank\" rel=\"noreferrer noopener\">this step-by-step description on opensource.com<\/a>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ wget https:\/\/download.java.net\/java\/GA\/jdk17\/0d483333a00540d886896bac774ff48b\/35\/GPL\/openjdk-17_linux-aarch64_bin.tar.gz\n$ mkdir ~\/bin\n$ echo PATH=$PATH:$HOME\/bin &gt;&gt; ~\/.bashrc\n$ source ~\/.bashrc\n$ tar --extract --file openjdk-17_linux-aarch64_bin.tar.gz --directory=$HOME\/bin\n$ bin\/jdk-17\/bin\/java -version\nopenjdk version \"17\" 2021-09-14\nOpenJDK Runtime Environment (build 17+35-2724)\nOpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)<\/pre>\n\n\n\n<p>Now let's make it easier to start Java:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo update-alternatives --install \"\/usr\/bin\/java\" \"java\" \"\/home\/pi\/bin\/jdk-17\/bin\/java\" 1\n$ java -version\nopenjdk version \"17\" 2021-09-14\nOpenJDK Runtime Environment (build 17+35-2724)\nOpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)<\/pre>\n\n\n\n<p>Look at that, Java 17 on the Raspberry Pi! \ud83d\ude09<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h3-3--isual-tudio-ode\">Visual Studio Code<\/h3>\n\n\n\n<p>Check \"<a href=\"https:\/\/foojay.io\/today\/java-development-with-vs-code-on-the-raspberry-pi\/\" target=\"_blank\" rel=\"noreferrer noopener\">Java Development with VS Code on the Raspberry Pi<\/a>\" for more info about using VSC on the Raspberry Pi, but in short install like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt update\n$ sudo apt install code<\/pre>\n\n\n\n<p>Now let's try the smallest Java program you can write to check and print the Java version...<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class HelloWorld {\n    public static void main(String[] args) {\n        System.out.println(\"Hello World, greeting you with Java version: \" \n            + System.getProperty(\"java.version\"));\n    }\n}<\/pre>\n\n\n\n<p>And, finally, as we can run Java files without compiling them, since Java 11, we can just run it like this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ java HelloWorld.java\nHello World, greeting you with Java version: 17<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"493\" src=\"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png\" alt=\"\" class=\"wp-image-46466\" srcset=\"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png 897w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18-700x385.png 700w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18-768x422.png 768w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><figcaption class=\"wp-element-caption\">Hello World Java code running on Raspberry Pi with JDK 17<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2-4--un-a-i4-project\">Run a Pi4J project<\/h2>\n\n\n\n<p>Now let's see if we can run the minimal example project of the Pi4J project to control a LED and read a button state with some basic electronic components.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"378\" src=\"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb-1024x378.png\" alt=\"\" class=\"wp-image-46491\" srcset=\"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb-1024x378.png 1024w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb-700x259.png 700w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb-768x284.png 768w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb-1536x567.png 1536w, https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/led-button_bb.png 1860w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Minimal electronic setup for a Pi4J demo project<\/figcaption><\/figure>\n\n\n\n<p>This is fully described on \"<a href=\"https:\/\/pi4j.com\/getting-started\/minimal-example-application\/\" target=\"_blank\" rel=\"noreferrer noopener\">Minimal example application<\/a>\", but this is the <em>TL;DR;<\/em> version, open a terminal and run the following commands to install Maven, get the demo code, build and run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo apt install maven\n$ git clone https:\/\/github.com\/Pi4J\/pi4j-example-minimal.git\n$ cd pi4j-example-minimal\/\n$ mvn clean package\n$ cd target\/distribution\n$ ls -l\n$ sudo .\/run.sh\nLED high\nLED low\nLED high\nButton was pressed for the 1th time\nLED low\nLED high\nButton was pressed for the 2th time\nLED low\n...\nLED low\nLED high\nButton was pressed for the 5th time<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2-5--onclusion\">Conclusion<\/h2>\n\n\n\n<p>As always, Java runs everywhere so no surprises here with version 17 on the Raspberry Pi! The Pi4J example application also runs without problems!<\/p>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>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.<\/p>\n<p>So, a perfect opportunity to freshen up my #JavaOnRaspberryPi presentation with some hot-off-the-press versions.<\/p>\n","protected":false},"author":47,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[193,678,203,274],"tags":[545,190,202],"class_list":["post-46464","post","type-post","status-publish","format-standard","hentry","category-javafx","category-pi4j","category-raspberry-pi","category-vscode","tag-java-17","tag-javafx","tag-raspberry-pi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today<\/title>\n<meta name=\"description\" content=\"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!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today\" \/>\n<meta property=\"og:description\" content=\"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!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/\" \/>\n<meta property=\"og:site_name\" content=\"foojay\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-25T13:56:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-06T12:18:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png\" \/>\n<meta name=\"author\" content=\"Frank Delporte\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Frank Delporte\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/\"},\"author\":{\"name\":\"Frank Delporte\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/a396e036ad1bf495d0920486b5b6c558\"},\"headline\":\"Java 17 on the Raspberry Pi\",\"datePublished\":\"2021-09-25T13:56:53+00:00\",\"dateModified\":\"2024-02-06T12:18:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/\"},\"wordCount\":615,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-21-at-15.40.18.png\",\"keywords\":[\"Java 17\",\"JavaFX\",\"Raspberry Pi\"],\"articleSection\":[\"JavaFX\",\"Pi4J\",\"Raspberry Pi\",\"VS Code\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/\",\"url\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/\",\"name\":\"Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-21-at-15.40.18.png\",\"datePublished\":\"2021-09-25T13:56:53+00:00\",\"dateModified\":\"2024-02-06T12:18:16+00:00\",\"description\":\"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!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#primaryimage\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-21-at-15.40.18.png\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2021\\\/08\\\/Screenshot-2021-08-21-at-15.40.18.png\",\"width\":897,\"height\":493},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/java-17-on-the-raspberry-pi\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/foojay.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java 17 on the Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"name\":\"foojay\",\"description\":\"a place for friends of OpenJDK\",\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/foojay.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\",\"name\":\"foojay\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"width\":512,\"height\":512,\"caption\":\"foojay\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/foojay2020\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/a396e036ad1bf495d0920486b5b6c558\",\"name\":\"Frank Delporte\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/cropped-frank-delporte-scaled-1-96x96.jpg\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/cropped-frank-delporte-scaled-1-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2025\\\/05\\\/cropped-frank-delporte-scaled-1-96x96.jpg\",\"caption\":\"Frank Delporte\"},\"description\":\"Frank Delporte is a Java Champion, Java Developer, Technical Writer at Azul, Blogger, Author of \\\"Getting started with Java on Raspberry Pi\\\", and Pi4J Contributor. Frank blogs about his experiments with Java and JavaFX, sometimes combined with electronic components, on the Raspberry Pi.\",\"sameAs\":[\"https:\\\/\\\/webtechie.be\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/frankdelporte\\\/\"],\"url\":\"https:\\\/\\\/foojay.io\\\/today\\\/author\\\/frankdelporte\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today","description":"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!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/","og_locale":"en_US","og_type":"article","og_title":"Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today","og_description":"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!","og_url":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/","og_site_name":"foojay","article_published_time":"2021-09-25T13:56:53+00:00","article_modified_time":"2024-02-06T12:18:16+00:00","og_image":[{"url":"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png","type":"","width":"","height":""}],"author":"Frank Delporte","twitter_misc":{"Written by":"Frank Delporte","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#article","isPartOf":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/"},"author":{"name":"Frank Delporte","@id":"https:\/\/foojay.io\/#\/schema\/person\/a396e036ad1bf495d0920486b5b6c558"},"headline":"Java 17 on the Raspberry Pi","datePublished":"2021-09-25T13:56:53+00:00","dateModified":"2024-02-06T12:18:16+00:00","mainEntityOfPage":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/"},"wordCount":615,"commentCount":6,"publisher":{"@id":"https:\/\/foojay.io\/#organization"},"image":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#primaryimage"},"thumbnailUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png","keywords":["Java 17","JavaFX","Raspberry Pi"],"articleSection":["JavaFX","Pi4J","Raspberry Pi","VS Code"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/","url":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/","name":"Getting Started with Java 17 on the Raspberry Pi | Foojay.io Today","isPartOf":{"@id":"https:\/\/foojay.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#primaryimage"},"image":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#primaryimage"},"thumbnailUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png","datePublished":"2021-09-25T13:56:53+00:00","dateModified":"2024-02-06T12:18:16+00:00","description":"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!","breadcrumb":{"@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#primaryimage","url":"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2021\/08\/Screenshot-2021-08-21-at-15.40.18.png","width":897,"height":493},{"@type":"BreadcrumbList","@id":"https:\/\/foojay.io\/today\/java-17-on-the-raspberry-pi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/foojay.io\/"},{"@type":"ListItem","position":2,"name":"Java 17 on the Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/foojay.io\/#website","url":"https:\/\/foojay.io\/","name":"foojay","description":"a place for friends of OpenJDK","publisher":{"@id":"https:\/\/foojay.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/foojay.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/foojay.io\/#organization","name":"foojay","url":"https:\/\/foojay.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/","url":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","width":512,"height":512,"caption":"foojay"},"image":{"@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/foojay2020"]},{"@type":"Person","@id":"https:\/\/foojay.io\/#\/schema\/person\/a396e036ad1bf495d0920486b5b6c558","name":"Frank Delporte","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/05\/cropped-frank-delporte-scaled-1-96x96.jpg","url":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/05\/cropped-frank-delporte-scaled-1-96x96.jpg","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2025\/05\/cropped-frank-delporte-scaled-1-96x96.jpg","caption":"Frank Delporte"},"description":"Frank Delporte is a Java Champion, Java Developer, Technical Writer at Azul, Blogger, Author of \"Getting started with Java on Raspberry Pi\", and Pi4J Contributor. Frank blogs about his experiments with Java and JavaFX, sometimes combined with electronic components, on the Raspberry Pi.","sameAs":["https:\/\/webtechie.be\/","https:\/\/www.linkedin.com\/in\/frankdelporte\/"],"url":"https:\/\/foojay.io\/today\/author\/frankdelporte\/"}]}},"_links":{"self":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/46464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/comments?post=46464"}],"version-history":[{"count":0,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/46464\/revisions"}],"wp:attachment":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/media?parent=46464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/categories?post=46464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/tags?post=46464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}