简体   繁体   English

在Raspberry Pi上运行Javafx GUI

[英]Running Javafx GUI on the Raspberry Pi

I have programs that I need to run on the Raspberry Pi and show the output on an lcd connected to the Raspberry Pi. 我有需要在Raspberry Pi上运行的程序,并在连接到Raspberry Pi的lcd上显示输出。

I have used Java for the programming and JavaFX specifically for the GUI. 我已经将Java用于编程,JavaFX专门用于GUI。 But on running the program on the Pi, it gives different errors, sometimes not detecting javafx extensions, sometimes not being able to find the main classes. 但是在Pi上运行程序时,它会产生不同的错误,有时候不会检测到javafx扩展,有时候无法找到主类。

The OS I'm using for Pi is Raspbian. 我用于Pi的操作系统是Raspbian。 And performing all the communication on Putty. 并在Putty上进行所有沟通。 I have tried using jdk 1.8.0, 1.7.0; 我尝试过使用jdk 1.8.0,1.7.0; ejdk; ejdk; openjdk. OpenJDK的。 But all seem to give different errors. 但似乎都有不同的错误。

It would be really helpful if someone could tell me a way to install the relevant jdk and jre on the Pi, if I format my SD Card and start over with everything. 如果有人能告诉我一种在Pi上安装相关jdk和jre的方法,如果我格式化我的SD卡并重新开始一切,那将是非常有用的。

Also, programs without the use of Javafx run without a glitch on the Pi. 此外,没有使用Javafx的程序在Pi上没有毛刺的情况下运行。

As you can read here , the most recent JDK versions for ARM don't include JavaFX. 正如您在此处所读到的,ARM的最新JDK版本不包括JavaFX。

If you want to use JavaFX in your Raspberry Pi, the solution is adding the missing JavaFX SDK. 如果您想在Raspberry Pi中使用JavaFX,解决方案是添加缺少的JavaFX SDK。

If you install the recent Oracle's JDK for ARM from here (select jdk-8u111-linux-arm32-vfp-hflt.tar.gz), then you will need to download the JavaFX SDK from Gluon's site (select JavaFX Embedded SDK for armv6 hard float). 如果从这里安装最新的Oracle JDK for ARM(选择jdk-8u111-linux-arm32-vfp-hflt.tar.gz),则需要从Gluon的站点下载JavaFX SDK(为armv6选择JavaFX Embedded SDK)浮动)。

Once you have the file, unzip it, and copy the folders to your JDK. 获得文件后,将其解压缩,然后将文件夹复制到JDK。

Assuming you have downloaded armv6hf-sdk-8.60.8.zip to your Pi/Downloads folder, and you have unzip it to a folder armv6hf-sdk , like in the following picture: 假设您已将armv6hf-sdk-8.60.8.zip下载到Pi / Downloads文件夹,并且已将其解压缩到文件夹armv6hf-sdk ,如下图所示:

Pi ARM JavaFX

using the following commands will allow you moving from command line the files to the JDK required folders. 使用以下命令将允许您从命令行将文件移动到JDK所需的文件夹。 You can use a graphic tool for this as well. 您也可以使用图形工具。

cd Downloads
sudo chown -R root:root armv6hf-sdk
cd armv6hf-sdk
sudo mv lib/javafx-mx.jar /opt/jdk1.8.0_111/lib/
cd rt/lib/
sudo mv j* /opt/jdk1.8.0_111/jre/lib/
sudo mv arm/* /opt/jdk1.8.0_111/jre/lib/arm/
sudo mv ext/* /opt/jdk1.8.0_111/jre/lib/ext/ 

After that you should be able to run Java/JavaFX programs. 之后,您应该能够运行Java / JavaFX程序。

If you have a look also at the Gluon IDE plugins , you will be able to create projects on your desktop and deploy them remotely on your Pi (as well as on your desktop and mobile devices). 如果您还要了解Gluon IDE 插件 ,您将能够在桌面上创建项目并在Pi(以及桌面和移动设备)上远程部署它们。 Check the documentation here to set up your build script. 请查看此处的文档以设置构建脚本。 And check the sample GluonSQLite here . 并在此处查看样本GluonSQLite。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM