PiJava - Part 5 - Running the minimal JavaFX 11 application on Raspberry PI

In part 2 of this blog series Java 11 was successfully installed on a PI.

And in part 4 a running Java FX jar was generated on a PC.

Time to move back to the PI…

Run the JavaFX .jar application

Make sure you have a the Liberica Java JDK installed as described in part 2 as JavaFX is not part of the “normal” Java JDK.

As JavaFX is part of LibericaJDK, our start script becomes a lot easier as we don’t need to provide the module settings:

sudo java -jar ../out/MinimalJavaFx11Application-0.1-SNAPSHOT.jar

The application runs perfectly but full-screen without any option to exit, as the application toolbar is not added. Something to further research why this is different, but adding a “Close” application button to the application solves this for now…

How it looks

When taking a screenshot while the application runs, with following command (a delay of 20" so the application can be started from another terminal), the JavaFX application is not captured at all and we only see the terminals I had running for the screenshot tool and starting the JavaFX application.

scrot -d 20

But this is what is actually on the screen:

Conclusion

We can run the minimal JavaFX jar from the previous blog post with the Java JDK of BellSoft which includes JavaFX.

One step left now… A more extended JavaFX application which is also able to toggle a GPIO. Some more challenges ahead ;-)