在Raspberry Pi中运行JavaFX Application

时间:2017-12-26 06:25:13

标签: javafx raspberry-pi

我创建了一个JavaFx应用程序。现在我想在Raspberry Pi中运行这个应用程序。但是,虽然我试图运行它没有响应并给我以下错误。

Raspberry Pi信息

            pi@raspberrypi:~ $ cat /etc/os-release
            PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
            NAME="Raspbian GNU/Linux"
            VERSION_ID="9"
            VERSION="9 (stretch)"
            ID=raspbian
            ID_LIKE=debian
            HOME_URL="http://www.raspbian.org/"
            SUPPORT_URL="http://www.raspbian.org/RaspbianForums"             
            BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

当我尝试运行我的应用程序时,发生了以下错误

            cannot open display
            cannot create resource

从终端

运行时的错误详细信息
        Exception in Application start method
        Exception in thread "main" 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 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$152(LauncherImpl.java:182)
            at java.lang.Thread.run(Thread.java:748)
        Caused by: java.awt.AWTError: Can't connect to X11 window server using 'localhost:0' as the value of the DISPLAY variable.
            at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
            at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
            at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:264)
            at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
            at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
            at java.awt.Window.initGC(Window.java:475)
            at java.awt.Window.init(Window.java:495)
            at java.awt.Window.<init>(Window.java:537)
            at java.awt.Frame.<init>(Frame.java:420)
            at java.awt.Frame.<init>(Frame.java:385)
            at javax.swing.JFrame.<init>(JFrame.java:189)
            at com.qps.swing.frame.FirstScene.<init>(FirstScene.java:33)
            at qps_swing.QPS_Swing.start(QPS_Swing.java:20)
            at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
            at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
            at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
            at java.security.AccessController.doPrivileged(Native Method)
            at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
            at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
            at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
... 1 more

从Netbeans IDE运行时的错误详细信息

        ant -f /home/pi/NetBeansProjects/Test jfxsa-run
        init:
        deps-clean:
        Updating property file: /home/pi/NetBeansProjects/Test/build/built-clean.properties
        Deleting directory /home/pi/NetBeansProjects/Test/build
        clean:
        init:
        deps-jar:
        Created dir: /home/pi/NetBeansProjects/Test/build
        Updating property file: /home/pi/NetBeansProjects/Test/build/built-jar.properties
        Created dir: /home/pi/NetBeansProjects/Test/build/classes
        Created dir: /home/pi/NetBeansProjects/Test/build/empty
        Created dir: /home/pi/NetBeansProjects/Test/build/generated-sources/ap-source-output
        Compiling 1 source file to /home/pi/NetBeansProjects/Test/build/classes
        compile:
        Created dir: /home/pi/NetBeansProjects/Test/dist
        Detected JavaFX Ant API version 1.3
        Launching <fx:jar> task from /opt/jdk1.8.0_151/jre/../lib/ant-javafx.jar
        Warning: From JDK7u25 the Codebase manifest attribute should be used to restrict JAR repurposing.
                 Please set manifest.custom.codebase property to override the current default non-secure value '*'.
        Launching <fx:deploy> task from /opt/jdk1.8.0_151/jre/../lib/ant-javafx.jar
        Internal error. Missing resources [/resources/web-files/javafx-loading-100x100.gif]
        /home/pi/NetBeansProjects/Test/nbproject/jfx-impl.xml:1487: The following error occurred while executing this line:
        /home/pi/NetBeansProjects/Test/nbproject/jfx-impl.xml:3134: The following error occurred while executing this line:
        /home/pi/NetBeansProjects/Test/nbproject/jfx-impl.xml:2096: Error: -includedt requires the java deployment toolkit, which is not included in this distribution
        BUILD FAILED (total time: 18 seconds)

0 个答案:

没有答案