在Raspberry Pi上运行Javafx GUI [英] Running Javafx GUI on the Raspberry Pi

查看:247
本文介绍了在Raspberry Pi上运行Javafx GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Raspberry Pi上运行程序,并在连接到Raspberry Pi的lcd上显示输出。



我已经使用Java进行编程和JavaFX专门用于GUI。但是在Pi上运行程序时,它会产生不同的错误,有时候不会检测到javafx扩展,有时候无法找到主类。



操作系统我是用于Pi是Raspbian。并在Putty上进行所有沟通。我尝试过使用jdk 1.8.0,1.7.0; ejdk; OpenJDK的。但是所有人似乎都给出了不同的错误。



如果有人能告诉我一种方法在Pi上安装相关的jdk和jre,如果我格式化我的话会非常有用SD卡,重新开始。



此外,没有使用Javafx的程序在Pi上没有毛刺的情况下运行。

解决方案

正如你可以阅读



使用以下命令将允许您移动从命令行将文件转换为JDK所需的文件夹。您也可以使用图形工具。

  cd下载
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 /

之后你应该可以运行Java / JavaFX程序。 / p>

如果您还要了解Gluon IDE 插件,您将能够在桌面上创建项目并在Pi(以及桌面和移动设备)上远程部署它们。请查看文档此处以设置构建脚本。并查看样本GluonSQLite 此处


I have programs that I need to run on the Raspberry Pi and show the output on an lcd connected to the Raspberry Pi.

I have used Java for the programming and JavaFX specifically for the 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.

The OS I'm using for Pi is Raspbian. And performing all the communication on Putty. I have tried using jdk 1.8.0, 1.7.0; ejdk; 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.

Also, programs without the use of Javafx run without a glitch on the Pi.

解决方案

As you can read here, the most recent JDK versions for ARM don't include JavaFX.

If you want to use JavaFX in your Raspberry Pi, the solution is adding the missing 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).

Once you have the file, unzip it, and copy the folders to your 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:

using the following commands will allow you moving from command line the files to the JDK required folders. 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.

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). Check the documentation here to set up your build script. And check the sample GluonSQLite here.

这篇关于在Raspberry Pi上运行Javafx GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆