我的硬件:
我的软件:
- 操作系统:Raspbian GNU/Linux 8 (jessie Lite) [Ohne X]
- 内核:Linux 4.4.21+
- 架构:手臂
- 使用设备树覆盖激活触摸显示屏和 Hifiberry
- Java:jdk-8u121-linux-arm32-vfp-hflt
- JavaFXPorts (Gluon):JavaFX Embedded SDK 版本 8.60.8 armv6 硬浮点
到目前为止我做了什么:
首先,我从 Oracel klick下载了当前的 JDK 版本(Linux ARM 32 Hard Float ABI 的 Java 8u121)。
我把所有东西都打开了/opt/
接下来我安装了新的Java版本......
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.8.0_121/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.8.0_121/bin/javac" 1
sudo update-alternatives --set "java" "/opt/jdk1.8.0_121/bin/java"
sudo update-alternatives --set "javac" "/opt/jdk1.8.0_121/bin/javac"
当我现在进入java -version
pi@raspberrypi:/opt $ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)
到目前为止看起来不错,不是吗?
其次,我从 Gluon klick下载了当前版本的 JavaFXPorts(JavaFX Embedded SDK Version 8.60.8 armv6 hard float)。
我将以下文件复制到 JDK 目录 ( /opt/jdk1.8.0_121 ) 中,如2.1.4 中所述。
armv6hf-sdk/rt/lib/ext/jfxrt.jar------------------------jre/lib/ext/
i@raspberrypi:/opt/jdk1.8.0_121/jre/lib/ext $ ls -l
insgesamt 17140
-rw-r--r-- 1 uucp 143 3860502 Dez 13 02:40 cldrdata.jar
-rw-r--r-- 1 uucp 143 8286 Dez 13 02:40 dnsns.jar
-rw-r--r-- 1 uucp 143 44516 Dez 13 02:40 jaccess.jar
-rw-r--r-- 1 uucp 143 9771185 Mär 14 19:52 jfxrt.jar
-rw-r--r-- 1 uucp 143 1179093 Dez 13 02:40 localedata.jar
-rw-r--r-- 1 uucp 143 746 Dez 13 02:40 meta-index
-rw-r--r-- 1 uucp 143 2022531 Dez 13 02:40 nashorn.jar
-rw-r--r-- 1 uucp 143 42154 Dez 13 02:40 sunec.jar
-rw-r--r-- 1 uucp 143 280161 Dez 13 02:40 sunjce_provider.jar
-rw-r--r-- 1 uucp 143 251327 Dez 13 02:40 sunpkcs11.jar
-rw-r--r-- 1 uucp 143 68924 Dez 13 02:40 zipfs.jar
armv6hf-sdk/rt/lib/arm/*-------------------------------jre/lib/arm/
pi@raspberrypi:/opt/jdk1.8.0_121/jre/lib/arm $ ls -l
insgesamt 54520
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:43 client
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 jli
-rwxr-xr-x 1 uucp 143 620 Dez 13 02:40 jvm.cfg
-rwxr-xr-x 1 uucp 143 12458 Dez 13 02:40 libattach.so
-rwxr-xr-x 1 uucp 143 28475 Dez 13 02:40 libawt_headless.so
-rwxr-xr-x 1 uucp 143 603570 Dez 13 02:40 libawt.so
-rwxr-xr-x 1 uucp 143 384820 Dez 13 02:40 libawt_xawt.so
-rwxr-xr-x 1 uucp 143 8419 Dez 13 02:40 libbci.so
-rwxr-xr-x 1 uucp 143 175043 Dez 13 02:40 libdcpr.so
-rwxr-xr-x 1 uucp 143 61200 Mär 14 19:54 libdecora_sse.so
-rwxr-xr-x 1 uucp 143 17694 Dez 13 02:40 libdt_socket.so
-rwxr-xr-x 1 uucp 143 427804 Dez 13 02:40 libfontmanager.so
-rwxr-xr-x 1 uucp 143 49825 Mär 14 19:54 libfxplugins.so
-rwxr-xr-x 1 uucp 143 31428 Mär 14 19:54 libglass_monocle.so
-rwxr-xr-x 1 uucp 143 15946 Mär 14 19:54 libglass_monocle_x11.so
-rwxr-xr-x 1 uucp 143 194284 Mär 14 19:54 libglass.so
-rwxr-xr-x 1 uucp 143 1676215 Mär 14 19:54 libgstreamer-lite.so
-rwxr-xr-x 1 uucp 143 159094 Dez 13 02:40 libhprof.so
-rwxr-xr-x 1 uucp 143 42623 Dez 13 02:40 libinstrument.so
-rwxr-xr-x 1 uucp 143 43882 Dez 13 02:40 libj2gss.so
-rwxr-xr-x 1 uucp 143 13521 Dez 13 02:40 libj2pcsc.so
-rwxr-xr-x 1 uucp 143 68103 Dez 13 02:40 libj2pkcs11.so
-rwxr-xr-x 1 uucp 143 6527 Dez 13 02:40 libjaas_unix.so
-rwxr-xr-x 1 uucp 143 20825 Dez 13 02:40 libjava_crw_demo.so
-rwxr-xr-x 1 uucp 143 23301 Mär 14 19:54 libjavafx_font_freetype.so
-rwxr-xr-x 1 uucp 143 20564 Mär 14 19:54 libjavafx_font_pango.so
-rwxr-xr-x 1 uucp 143 14950 Mär 14 19:54 libjavafx_font.so
-rwxr-xr-x 1 uucp 143 218702 Mär 14 19:54 libjavafx_iio.so
-rwxr-xr-x 1 uucp 143 190543 Dez 13 02:40 libjava.so
-rwxr-xr-x 1 uucp 143 5704 Dez 13 02:40 libjawt.so
-rwxr-xr-x 1 uucp 143 255277 Dez 13 02:40 libjdwp.so
-rwxr-xr-x 1 uucp 143 23126 Dez 13 02:40 libjfr.so
-rwxr-xr-x 1 uucp 143 207761 Mär 14 19:54 libjfxmedia.so
-rwxr-xr-x 1 uucp 143 47082651 Mär 14 19:54 libjfxwebkit.so
-rwxr-xr-x 1 uucp 143 231488 Dez 13 02:40 libjpeg.so
-rwxr-xr-x 1 uucp 143 10601 Dez 13 02:40 libjsdt.so
-rwxr-xr-x 1 uucp 143 9365 Dez 13 02:40 libjsig.so
-rwxr-xr-x 1 uucp 143 66283 Dez 13 02:40 libjsoundalsa.so
-rwxr-xr-x 1 uucp 143 5789 Dez 13 02:40 libjsound.so
-rwxr-xr-x 1 uucp 143 331773 Dez 13 02:40 libkcms.so
-rwxr-xr-x 1 uucp 143 328967 Dez 13 02:40 liblcms.so
-rwxr-xr-x 1 uucp 143 48263 Dez 13 02:40 libmanagement.so
-rwxr-xr-x 1 uucp 143 738200 Dez 13 02:40 libmlib_image.so
-rwxr-xr-x 1 uucp 143 101978 Dez 13 02:40 libnet.so
-rwxr-xr-x 1 uucp 143 79517 Dez 13 02:40 libnio.so
-rwxr-xr-x 1 uucp 143 11385 Dez 13 02:40 libnpt.so
-rwxr-xr-x 1 uucp 143 42591 Mär 14 19:54 libprism_common.so
-rwxr-xr-x 1 uucp 143 59647 Mär 14 19:54 libprism_es2_eglfb.so
-rwxr-xr-x 1 uucp 143 54157 Mär 14 19:54 libprism_es2_monocle.so
-rwxr-xr-x 1 uucp 143 56508 Mär 14 19:54 libprism_sw.so
-rwxr-xr-x 1 uucp 143 8840 Dez 13 02:40 libresource.so
-rwxr-xr-x 1 uucp 143 53534 Dez 13 02:40 libsaproc.so
-rwxr-xr-x 1 uucp 143 23669 Dez 13 02:40 libsctp.so
-rwxr-xr-x 1 uucp 143 380853 Dez 13 02:40 libsplashscreen.so
-rwxr-xr-x 1 uucp 143 238184 Dez 13 02:40 libsunec.so
-rwxr-xr-x 1 uucp 143 408161 Dez 13 02:40 libt2k.so
-rwxr-xr-x 1 uucp 143 165565 Dez 13 02:40 libunpack.so
-rwxr-xr-x 1 uucp 143 46976 Dez 13 02:40 libverify.so
-rwxr-xr-x 1 uucp 143 110763 Dez 13 02:40 libzip.so
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:43 server
armv6hf-sdk/rt/lib/javafx.platform.properties-----jre/lib/
armv6hf-sdk/rt/lib/javafx.properties----------------jre/lib/
armv6hf-sdk/rt/lib/jfxswt.jar--------------------------jre/lib/
pi@raspberrypi:/opt/jdk1.8.0_121/jre/lib $ ls -l
insgesamt 72848
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 applet
drwxr-xr-x 5 uucp 143 4096 Mär 14 19:54 arm
-rw-r--r-- 1 uucp 143 1378 Dez 13 02:40 calendars.properties
-rw-r--r-- 1 uucp 143 3135391 Dez 13 02:40 charsets.jar
-rw-r--r-- 1 uucp 143 84311 Dez 13 02:40 classlist
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 cmm
-rw-r--r-- 1 uucp 143 5916 Dez 13 02:40 content-types.properties
-r--r--r-- 1 uucp 143 4122 Dez 13 02:40 currency.data
drwxr-xr-x 2 uucp 143 4096 Mär 14 19:52 ext
-rw-r--r-- 1 uucp 143 3901 Dez 13 02:40 flavormap.properties
-r--r--r-- 1 uucp 143 1678 Dez 13 02:40 fontconfig.bfc
-rw-r--r-- 1 uucp 143 1938 Dez 13 02:40 fontconfig.properties.src
-r--r--r-- 1 uucp 143 4532 Dez 13 02:40 fontconfig.RedHat.5.bfc
-rw-r--r-- 1 uucp 143 8841 Dez 13 02:40 fontconfig.RedHat.5.properties.src
-r--r--r-- 1 uucp 143 4250 Dez 13 02:40 fontconfig.RedHat.6.bfc
-rw-r--r-- 1 uucp 143 8735 Dez 13 02:40 fontconfig.RedHat.6.properties.src
-r--r--r-- 1 uucp 143 6702 Dez 13 02:40 fontconfig.SuSE.10.bfc
-rw-r--r-- 1 uucp 143 16772 Dez 13 02:40 fontconfig.SuSE.10.properties.src
-r--r--r-- 1 uucp 143 7032 Dez 13 02:40 fontconfig.SuSE.11.bfc
-rw-r--r-- 1 uucp 143 16781 Dez 13 02:40 fontconfig.SuSE.11.properties.src
-r--r--r-- 1 uucp 143 4668 Dez 13 02:40 fontconfig.Turbo.bfc
-rw-r--r-- 1 uucp 143 9192 Dez 13 02:40 fontconfig.Turbo.properties.src
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 fonts
-rw-r--r-- 1 uucp 143 13962 Dez 13 02:40 hijrah-config-umalqura.properties
drwxr-xr-x 3 uucp 143 4096 Dez 13 02:40 images
-rw-r--r-- 1 uucp 143 992 Mär 14 19:58 javafx.platform.properties
-rw-r--r-- 1 uucp 143 55 Mär 14 19:58 javafx.properties
-rw-r--r-- 1 uucp 143 116446 Dez 13 02:40 jce.jar
-rwxr-xr-x 1 uucp 143 7978 Dez 13 02:40 jexec
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 jfr
-rw-r--r-- 1 uucp 143 560581 Dez 13 02:40 jfr.jar
-rw-r--r-- 1 uucp 143 521 Mär 14 19:59 jfxswt.jar
-rw-r--r-- 1 uucp 143 647051 Dez 13 02:40 jsse.jar
-rw-r--r-- 1 uucp 143 4226 Dez 13 02:40 jvm.hprof.txt
-rw-r--r-- 1 uucp 143 2455 Dez 13 02:40 logging.properties
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 management
-rw-r--r-- 1 uucp 143 381 Dez 13 02:40 management-agent.jar
-rw-r--r-- 1 uucp 143 2034 Dez 13 02:40 meta-index
-rw-r--r-- 1 uucp 143 4464 Dez 13 02:40 net.properties
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 oblique-fonts
-rw-r--r-- 1 uucp 143 10393 Dez 13 02:40 psfontj2d.properties
-rw-r--r-- 1 uucp 143 2796 Dez 13 02:40 psfont.properties.ja
-rw-r--r-- 1 uucp 143 3505335 Dez 13 02:40 resources.jar
-rw-r--r-- 1 uucp 143 66152504 Dez 13 02:40 rt.jar
drwxr-xr-x 2 uucp 143 4096 Dez 13 02:40 security
-rw-r--r-- 1 uucp 143 1210 Dez 13 02:40 sound.properties
-rw-r--r-- 1 uucp 143 104311 Dez 13 02:40 tzdb.dat
我希望我在所有复制的文件上添加了正确的访问权限和组成员资格?
如上所述,我使用 Raspbian Lite,其中缺少 Pango 包。我已经读过我需要 OpenJFX klick。所以我安装了它
sudo apt-get install libpango-1.0-0:armhf libpangoft2-1.0-0:armhf
作为编程环境,我使用的是在我的家用 PC 上运行的Netbeans 8.2 。
首先,我制作了一个普通的“Hallo World”程序,它在 Raspberry Pi 上运行良好。
然后在我的家用 PC 上的 Netbeans 中构建一个非常简单的 JavaFX 程序并传输到 Raspberry Pi(到目录:/home/pi/Netbeans)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javafxbasic;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
/**
*
* @author zimt
*/
public class JavaFXbasic extends Application {
@Override
public void start(Stage primaryStage) {
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
StackPane root = new StackPane();
root.getChildren().add(btn);
Scene scene = new Scene(root, 320, 240);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
使用命令从我的家用 PC 通过 SSH 执行sudo java -jar JavaFXbasic.jar
而且我总是在 Raspberry Pi 上看到这个错误......(注意: .jar 文件在我的家用电脑上工作!)
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:745)
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 javafxbasic.JavaFXbasic.start(JavaFXbasic.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:92)
at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
... 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 javafxbasic.JavaFXbasic
我不太明白来自 Java 的错误消息...我认为我做错了什么或忘记安装 JavaFXPorts ?
我的系统怎么知道现在有 OpenJFX ?我没有运行任何安装命令或类似命令......或编辑类路径。
谢谢阅读