0% found this document useful (0 votes)
25 views

Using JavaFX On Raspberry Pi 3 With Gluon - Wim Deblauwe's Blog

This document details the steps to run a JavaFX application on a Raspberry Pi 3 using Gluon. The steps include: installing Raspbian OS on the Pi, downloading and installing Java 8, downloading and configuring the Gluon JavaFX SDK, building a simple JavaFX application using Gradle, and running the application on the Pi. With these steps, JavaFX applications can be deployed and run natively on the Raspberry Pi hardware.

Uploaded by

vishal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Using JavaFX On Raspberry Pi 3 With Gluon - Wim Deblauwe's Blog

This document details the steps to run a JavaFX application on a Raspberry Pi 3 using Gluon. The steps include: installing Raspbian OS on the Pi, downloading and installing Java 8, downloading and configuring the Gluon JavaFX SDK, building a simple JavaFX application using Gradle, and running the application on the Pi. With these steps, JavaFX applications can be deployed and run natively on the Raspberry Pi hardware.

Uploaded by

vishal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Wim Deblauwe's Blog

Home About My Spring Boot Book Support Me

Using JavaFX on Raspberry Pi 3 with Gluon


wimdeblauwe / August 26, 2017

In this post, I am going to detail the steps to get a simple JavaFX application running on the
Raspberry Pi 3 using Gluon.

Hardware
For this setup, I used the Raspberry Pi 3 with the o cial 7″ touchscreen connected.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy

Close and accept


Raspbian Installation

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 1/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

First o , download Raspbian from https://www.raspberrypi.org/downloads/raspbian/. I


chose the “RASPBIAN STRETCH WITH DESKTOP” version and burned it on an SD-card using
Etcher.

Insert the SD-card in the Raspberry Pi and let it boot. The screen should look like this when
done:

Find out the IP address of the Raspberry Pi by running ifconfig on the Pi itself or looking
at the DHCP clients list of your router.

Enable SSH to be able to easily copy les to the Raspberry Pi. See the o cial instructions
on how to do that.

Installation of Java
Download the ‘Linux ARM 32 Hard Float ABI’ Java SE Development kit from the Oracle
website. I downloaded jdk-8u144-linux-arm32-vfp-hflt.tar.gz.

Copy it to the device using SCP:

1 scp jdk-8u144-linux-arm32-vfp-hflt.tar.gz [email protected]:

(Replacing
Privacy & Cookies: 192.168.1.60
This site with
uses cookies. Bythe IP address
continuing of this
to use yourwebsite,
own device of course)
you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy
Now unzip the copied le:
Close and accept
1 tar zxf jdk-8u144-linux-arm32-vfp-hflt.tar.gz

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 2/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Move the JDK to a location of your choice. I choose /opt and also created a symbolic link
for future updates:

1 sudo mv ./jdk1.8.0_144/ /opt/


2 sudo ln -s /opt/jdk1.8.0_144/ /opt/jdk8

Check if Java works by checking the version of the java executable:

1 pi@raspberrypi:~ $ /opt/jdk8/bin/java -version


2 java version "1.8.0_144"
3 Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
4 Java HotSpot(TM) Client VM (build 25.144-b01, mixed mode)

Installation of JavaFX
Although Java 8 contains JavaFX by default, it does not contain what is needed to have
JavaFX applications running on the Raspberry Pi. For this, you need the Gluon JavaFX
Embedded SDK. Download it from http://gluonhq.com/products/mobile/javafxports/get/

Copy it to the Pi:

1 scp armv6hf-sdk-8.60.9.zip [email protected]:

On the Pi itself, unzip it and copy the unzipped les onto the just installed Java SDK. Take
note of what parts need to be copied where!

1 pi@raspberrypi:~ $ unzip armv6hf-sdk-8.60.9.zip


2 pi@raspberrypi:~ $ cp armv6hf-sdk/rt/lib/ext/jfxrt.jar /opt/jdk8/jre/li
3 pi@raspberrypi:~ $ cp armv6hf-sdk/rt/lib/arm/* /opt/jdk8/jre/lib/arm/
4 pi@raspberrypi:~ $ cp armv6hf-sdk/rt/lib/javafx.platform.properties /op
5 pi@raspberrypi:~ $ cp armv6hf-sdk/rt/lib/javafx.properties /opt/jdk8/jr
6 pi@raspberrypi:~ $ cp armv6hf-sdk/rt/lib/jfxswt.jar /opt/jdk8/jre/lib/

Running a JavaFX application


Just to get started with a very simple JavaFX application, we will take one of the javafxports
samples. First clone the repository at https://bitbucket.org/javafxports/samples

Build the HelloWorld sample using

1 ./gradlew :HelloWorld:build

Copy the created jar le to the Raspberry Pi:

1 scp HelloWorld/build/libs/HelloWorld.jar [email protected]:

Now open a terminal on the Raspberry Pi itself and start the application:

1 This
Privacy & Cookies: sudo
site/opt/jdk8/bin/java -jartoHelloworld.jar
uses cookies. By continuing use this website, you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy
NOTE: The sudo is needed to make the button click work. If you know of a way to avoid the
sudo part to make it work, leave a comment below!
Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 3/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Now you have JavaFX running on the Raspberry Pi:

There is no exit implemented in the demo application, so you have to kill it over SSH to
stop it.

Conclusion
We saw how get a JavaFX application running on the Raspberry Pi 3 hardware using the
Gluon JavaFX Embedded SDK. I will explain how I combined JavaFX with Spring Boot for a
real fun programming stack in a future post.

This know-how originated during the development of a PegusApps project.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy

Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 4/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Advertisements

Report this ad

Report this ad

Share this:

 Facebook 4  Twitter  Email  More

Like
3 bloggers like this.

August 26, 2017 in Uncategorized.

Related posts

Using Spring Boot with JavaFX

Privacy & Cookies:


Tip on This site uses
migration cookies.
to Spring By continuing
Boot to use
2 when using this website, you agree to their use.
Flyway
To nd out more, including how to control cookies, see here: Cookie Policy
Introduction to using JavaFX with afterburner.fx
Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 5/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

← Enable preview of Spring REST Docs snippets Using Spring Boot with JavaFX →
in IntelliJ IDEA

8 thoughts on “Using JavaFX on Raspberry Pi 3 with Gluon”

Pingback: Java desktop links of the week, August 28 – Jonathan Giles

Pingback: JavaFX links of the week, August 28 | JavaFX News, Demos and Insight // FX
Experience

Pingback: Using Spring Boot with JavaFX | Wim Deblauwe's Blog

letroll December 6, 2017 at 18:42

Maybe you must use sudo because your current user have not right on /opt/jdk8/bin/java?

Reply

nassim February 4, 2018 at 15:04

All steps done, it doesn’t work

Reply

wimdeblauwe February 4, 2018 at 19:48

You might want to ask a question on stackover ow.com to get somebody to help you
out.

Reply

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Mauro Rulli
To nd out more, including how to controlAugust
cookies,9,see
2018 at 12:11
here: Cookie Policy

To solve sudo: https://stackover ow.com/a/51255502/487545 Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 6/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Reply

wimdeblauwe August 9, 2018 at 13:57

Thanks for the tip!

Reply

Leave a Reply

Enter your comment here...

Search …

Recent Posts

Spring Boot book published via Infoq

Tip on migration to Spring Boot 2 when using Flyway

Datadog integration with AWS Elastic Beanstalk for Spring Boot application

PageImpl JSON serialization with Spring Boot 2

Building an AsciidoctorJ extension to execute JavaScript

Categories

Programming

Uncategorized

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
Tags
To nd out more, including how to control cookies, see here: Cookie Policy

annotations asciidoctor aspectj assertj ddd ex ex maven ex-mojos groovy hazelcast


Close and accept
java javafx jdvp jira liquidplanner Maven rest spring spring-
https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 7/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

boot spring-data unittesting

Meta

Register

Log in

Entries RSS

Comments RSS

WordPress.com

Advertisements

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy
Report this ad

Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 8/9
9/12/2018 Using JavaFX on Raspberry Pi 3 with Gluon | Wim Deblauwe's Blog

Create a free website or blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To nd out more, including how to control cookies, see here: Cookie Policy

Close and accept

https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/ 9/9

You might also like