0

I want to create some GUI for Raspberry Pi 1 B. So I found JavaFX is best for my purpose. Installed it following this tutorial : oracle.com/webfolder/technetwork/tutorials/obe/java/RaspberryPiFX/raspberryfx.html

Created Basic JavaFX Application-Hello World. Copied BasicFX.jar to pi and ran using ::

sudo java -jar BasicFX.jar But it showed this error :: error: could not find or load main class java

After searching for solution , I found this : stackoverflow.com/questions/38359076/how-can-i-get-javafx-working-on-raspberry-pi-3 . But Running it again showing this error now ::

Cannot open display
Exception in Application start method
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
        at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
        at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:182)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ExceptionInInitializerError
        at javafx.scene.Node.reapplyCss(Node.java:8983)
        at javafx.scene.Node.impl_reapplyCSS(Node.java:8946)
        at javafx.scene.Node.invalidatedScenes(Node.java:854)
        at javafx.scene.Node.setScenes(Node.java:919)
        at javafx.scene.Scene$9.invalidated(Scene.java:1119)
        at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
        at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
        at javafx.scene.Scene.setRoot(Scene.java:1072)
        at javafx.scene.Scene.<init>(Scene.java:347)
        at javafx.scene.Scene.<init>(Scene.java:223)
        at basicfx.BasicFX.start(BasicFX.java:37)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863)
        at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326)
        at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
        at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:93)
        at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:52)
        ... 1 more
Caused by: java.lang.NullPointerException
        at com.sun.javafx.font.PrismFontLoader.loadFont(PrismFontLoader.java:196)
        at javafx.scene.text.Font.<init>(Font.java:319)
        at javafx.scene.text.Font.getDefault(Font.java:86)
        at javafx.scene.CssStyleHelper.<clinit>(CssStyleHelper.java:1528)
        ... 19 more
Exception running application basicfx.BasicFX
0

I have installed Raspbian Stretch Lite. So,I needed to install X11 Xwindows.

I installed minimal packages, enough to run JavaFX ::

sudo apt install xorg  libgtk2.0-0

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.