2

So I have an OpenJDK 8 installed on Raspbian Stretch; it crashes all the time. I then manually installed Oracle JDK 8u201 ; my app runs fine now no crashes. It misses JavaFX, though. I installed JavaFX following this guide: https://wimdeblauwe.wordpress.com/2017/08/26/using-javafx-on-raspberry-pi-3-with-gluon/

That seems "mostly" fine, because previous error about missing class javafx/scene/Parent disappears. But now I'm missing javafx/embed/swing/JFXPanel. I need that because my application is Swing based, and I only need JavaFX because of WebView (Swing never received a working browser component).

I don't understand why they were shipping an incomplete API? Especially given that JFXPanel was working before with standard OpenJDK/OpenJFX installation (the one that was crashing for other reasons).

Is there a way I can "add" that missing class? I still have OpenJFX installed, perhaps I can locate the missing file there?


Update: To test, I copied jfxrt.jar from OpenJFK into the jvm's directory (renaming it, so it doesn't override the one by Gluon). Then you have to give additional permissions for /sys/class/input, following this document: https://alexconesa.wordpress.com/2017/08/14/udev-failed-to-write-to-sysclassinputmiceuevent-check-that-you-have-permission-to-access-input-devices-on-raspberry-pi/

Now the web view seems to be initialised, but then the system hangs. I could spot in the terminal

libEGL warning: DRI2: failed to authenticate

Indicating some QT problems (according to web searches). So I'm giving up here, seems you can't really use JavaFX reliably on the Pi. Kind of funny, given the amount of people that tell me all the time Swing is deprecated technology... it seems to be the most robust.

0

I also had lots of troubles getting my JavaFX to run on the Raspberry but finally it worked:

  1. FYI: The packaging tool is not available for ARM architectures (cp here)
  2. In our application the following class was missing "SwingFXUtils". So I compiled it, put it into a jar and into the JDK (/jdk1.8.0/jre/lib/ext) Alternatively it could be taken out of the jfxrt.jar (javafx/embed/swing/*) of a linux javafx JDK distribution
  3. You need to increase your GPU memory (to at least 128 MB)
  4. I increased the SWAP file from 100MB to 1GB (described here)
  5. Since javafx needs write rights on certain resources you need to start the jar with sudo e.g.: sudo java -jar yourjarfile.jar

=> Then it is starting... I also have another issue with the file choser dialog.

java.lang.UnsupportedOperationException at 
com.sun.glass.ui.monocle.MonocleApplication.staticCommonDialogs_showFileChooser( 
MonocleApplication.java:295) 

But this is for another day...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.