H4rd_B4se
Posts: 1
Joined: Wed Apr 27, 2016 8:51 am

How to run JavaFX on Raspberry Pi 3

Wed Apr 27, 2016 9:01 am

Good morning raspberries

I've read so much posts and tutorials, but I did not manage to install JavaFX on my RPI 3. In most times the tutorials werde to old.
Can anyone tell me how to set up JavaFX for the newest Pi? Please step for step, as I'm not quite familiar with the Pi.


Greets
H4rd_B4se

ceteri
Posts: 2
Joined: Wed Jul 13, 2016 5:59 pm

Re: How to run JavaFX on Raspberry Pi 3

Wed Jul 13, 2016 6:09 pm

I would also like to know this. I have tried all day to add javafx to raspberry pi 3 and i am still getting the error:

"JavaFX deployment library not found in the active JDK" in netbeans when i try to build, even though there are no errors showing in my code.

I downloaded the gluon community build for javaFX embedded sdk here: http://gluonhq.com/labs/javafxports/downloads/
and followed the instructions here: http://docs.gluonhq.com/javafxports/

please can anyone offer any easy to follow advice on getting javaFX working on raspberry pi 3!

spinetrak
Posts: 7
Joined: Mon Jun 06, 2016 2:56 pm

Re: How to run JavaFX on Raspberry Pi 3

Thu Jul 14, 2016 8:10 am

I have not tried this with the downloads from http://gluonhq.com/labs/javafxports/downloads/; instead, here is roughly what worked for me (RPi3):

1. installed Oracle JDK with

Code: Select all

sudo apt-get install oracle-java8-jdk
(if you don't have it yet) - note: you could also install Open JDK instead of the Oracle JDK; I did not go down that route
2. possibly make sure that that is the selected JDK with

Code: Select all

$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
3. You may also have to run

Code: Select all

raspi_config
to change the Memory Split to 256 MBytes (I think it is 64MBytes by default) - see "Advanced Options" in raspi_config
4. The Oracle JDK on Raspberry no longer includes JavaFX, so you'll need to also install OpenJFX, and basically "overlay" the Oracle JDK with OpenJFX; here is how I did it:
5. Go to http://chriswhocodes.com/
6. Download OpenJFX 8u60 stable for armv6hf (http://chriswhocodes.com/downloads/open ... rmv6hf.zip)
7.

Code: Select all

 unzip openjfx-8-sdk-overlay-linux-armv6hf.zip -d /home/pi/jdk1.8.0_92
8. I don't think I changed anything to compile; If you do get compile time errors; try

Code: Select all

javac -Djava.ext.dirs=/home/pi/jdk1.8.0_92/jre/lib/ext/ ...
i.e. tell javac explicitly where to pick up the installed extensions from
8.

Code: Select all

java -Djava.ext.dirs=/home/pi/jdk1.8.0_92/jre/lib/ext/ -Djavafx.platform=monocle -Dmonocle.screen.fb=/dev/fb1 -Dexec.mainClass="your.main.App"
9. Unfortunately, I don't remember how I got to use

Code: Select all

-Dmonocle.screen.fb=/dev/fb1
at runtime - this may be specific to my setup (I am using a PiTFT Display, i.e. not using HDMI/external monitor)
10. I also don't know what needs to get done in Netbeans to make this work - in my workflow, I use a Mac for development in an IDE with a maven-based build, and then I simply use git to pull updates onto my RPi and to compile and run - in other words, I do not at the moment do any remote debugging or anything like that. It's a bit of a pain, but trying to run any IDE on the RPi seemed even more painful.

ceteri
Posts: 2
Joined: Wed Jul 13, 2016 5:59 pm

Re: How to run JavaFX on Raspberry Pi 3

Thu Jul 14, 2016 1:53 pm

Thankyou, this was helpful. i did manage to get it to run on my Pi after a while, but it seems the JavaFX media libraries are not supported, which is what i needed (i need to play a .mp4 video clip). Any suggestions for a work around?

I'm trying to make an app that will start to play a random video from a directory on a key press and stop the video on the key release. I have this working fine on my PC using the JavaFX media library but cannot get it to work on the Pi


whysguy52
Posts: 2
Joined: Fri May 25, 2018 8:25 pm

Re: How to run JavaFX on Raspberry Pi 3

Wed May 22, 2019 5:34 am

Is there an update to this? I got stuck after unzipping the folder because the commands don't seem to work but i'm sure i'm not doing it right. i'm not that good with linux. I know I have to do something else after unzipping it but nothings working.

fruitoftheloom
Posts: 27225
Joined: Tue Mar 25, 2014 12:40 pm

Re: How to run JavaFX on Raspberry Pi 3

Wed May 22, 2019 9:28 am

whysguy52 wrote:
Wed May 22, 2019 5:34 am
Is there an update to this? I got stuck after unzipping the folder because the commands don't seem to work but i'm sure i'm not doing it right. i'm not that good with linux. I know I have to do something else after unzipping it but nothings working.

In 2016 the Operating System was likely Wheezy and since then we have had Jessie and Stretch, so appending (Necroing) to an out of date post seems pointless !


Maybe openjfx ?

https://packages.debian.org/stretch/openjfx
Take what I advise as advice not the utopian holy grail, and it is gratis !!

User avatar
Gavinmc42
Posts: 7501
Joined: Wed Aug 28, 2013 3:31 am

Re: How to run JavaFX on Raspberry Pi 3

Wed May 22, 2019 10:32 am

The last time I used JFX I installed Netbeans on Windows and the Oracle tools for Pi's.
Wrote the code on Windows and ported it via Netbeans over the Ethernet via TCP/IP?
Not a lot of fun getting it going well.

But then Oracle dropped all the support and it went Open, have not tried it since.
I needed minimum of a Pi2 to run my FX app and it only ran well when the Pi3's came out, never tried it on a Pi3B+.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Java”