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$launchApplication156ドル(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.Scene9ドル.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$launchApplication1163ドル(LauncherImpl.java:863)
 at com.sun.javafx.application.PlatformImpl.lambda$runAndWait176ドル(PlatformImpl.java:326)
 at com.sun.javafx.application.PlatformImpl.lambda$null174ドル(PlatformImpl.java:295)
 at java.security.AccessController.doPrivileged(Native Method)
 at com.sun.javafx.application.PlatformImpl.lambda$runLater175ドル(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
asked Dec 23, 2017 at 8:45

1 Answer 1

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
answered Dec 23, 2017 at 19:33
1
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. Commented Dec 16, 2019 at 14:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.