Launch Javafx GUI on Raspberry Pi

I have programs that I need to run on Raspberry Pi and show the result on lcd connected to Raspberry Pi.

I used Java for programming and JavaFX specifically for the graphical interface. But when launching the program on Pi, it gives different errors, sometimes without detecting the javafx extension, sometimes it is not able to find the main classes.

The OS I use for Pi is Raspbian. And the execution of the whole message on Putty. I tried using jdk 1.8.0, 1.7.0; ejdk; OpenJDK. But everyone seems to give different errors.

It would be very helpful if someone could tell me a way to install the appropriate jdk and jre on the Pi if I format my SD card and start with everything.

In addition, non-Javafx programs work without crashing on the Pi.

+4
source share
1 answer

As you can read here , the most recent ARM JDKs do not include JavaFX.

If you want to use JavaFX in your Raspberry Pi, the solution adds the missing JavaFX SDK.

If you installed the recent Oracle JDK for ARM from here (select jdk-8u111-linux-arm32-vfp-hflt.tar. Gz), then you will need to download the JavaFX SDK from the Gluon website (select the JavaFX Embedded SDK for the hard armv6 float).

Once you have the file, unzip it and copy the folders to the JDK.

Assuming that you downloaded the armv6hf-sdk-8.60.8.zip file into the Pi / Downloads folder, and you unzip it into the armv6hf-sdk folder, as in the following figure:

Pi ARM JavaFX

Using the following commands, you can move files from the command line to the desired JDK folders. You can also use a graphical tool for this.

 cd Downloads sudo chown -R root:root armv6hf-sdk cd armv6hf-sdk sudo mv lib/javafx-mx.jar /opt/jdk1.8.0_111/lib/ cd rt/lib/ sudo mv j* /opt/jdk1.8.0_111/jre/lib/ sudo mv arm/* /opt/jdk1.8.0_111/jre/lib/arm/ sudo mv ext/* /opt/jdk1.8.0_111/jre/lib/ext/ 

After that, you will be able to run Java / JavaFX programs.

If you also look at the Gluon IDE plugins , you can create projects on your desktop and place them remotely on your Pi (as well as on your desktop and mobile devices). Check the documentation here to customize your build script. And check out the GluonSQLite sample here .

+4
source

Source: https://habr.com/ru/post/1212463/


All Articles