How to run javafx with Raspberry Pi Posted on 2020/07/12

Perhaps quite a lot of people are looking for a way to run JAVA FX on Raspberry Pi, but since there is little information in Japanese, I will omit it here.

The following articles are the most interesting when searching with Google teacher. "Try combining JavaFX and GPIO control on Raspberry Pi ... but not yet completed orz"

I used it as a reference, but it didn't work.

Development tool uses Eclipse The method of introducing JAVAFX in Eclipse and developing it is left to other sites.
What you want to do
〇Introduce samba to Raspberry Pi and build a cross development environment with eclipse on windows For windows10 you also need to enable the samba client programmatically and features 〇 Automatically execute the executable jar edited by Scene Builder

Execution procedure abbreviation

  1. Write the Raspbian OS image to the SD card
  2. Initial setting
  3. Wireless LAN settings
  4. Install samba

$/sudo apt-get install samaba

  1. Edit smb.conf

sudo nano /etc/samba/smb.conf

Added to the last line

[raspberry_pi] comment = Share path = /home/pi/samba public = yes read only = no browsable = yes force user = pi

6. Create a samba folder in / home / pi

$ sudo mkdir /home/pi/samba

7. Service start * It will be started automatically when Raspberry Pi starts next time.  

$ sudo systemctl restart smbd

  1. Javafx placement ・ Https:// -Download JavaFX armv6hf SDK and unzip ZIP -Place the unzipped files in the samba folder ・ Right-click armv6hf-sdk to open it on the terminal ・ Permission confirmation -Pass the path * The javaFX so file can be executed by passing the path

    \$ export PATH="$PATH:/home/pi/samba/armv6hf-sdk"

・ Check the path

/$ echo PATH


  1. Place an executable jar containing the appropriate JAVAFX in samba (Example) ・ You can execute it by entering the following on the command line.

$ java --module-path /home/pi/samba/armv6hf-sdk/lib --add-modules=javafx.controls,javafx.fxml -jar /home/pi/samaba/test.jar

How to create a javaFX project in Eclipse 1. javaFX --Create a javaFX project 2. Enter the project name 3. Place the user library JAVAFX11 by adding the library 4. Set the native live library location of JAVAFX11 (Example) C: \ javafx-sdk-11.0.2 \ bin 5. Select FXML as the declarative UI language Change the name etc. as appropriate 6. Done 7. Edit XXX.fxml with Scene Builder Put the code in 8. Execution environment h uses java8. You may use java13, but you need to declare modularization in the command line arguments. 9. Create an executable jar User library JAVAFX11 needs to be packaged 10. Place it in / home / pi / samba and grant execution authority * Output directly to the folder on the Raspberry Pi side shared by samba 11. Below, test execution according to the example

$ java --module-path /home/pi/samba/armv6hf-sdk/lib --add-modules=javafx.controls,javafx.fxml -jar /home/pi/samaba/test.jar

12. Auto start settings

Execute the following command to copy the template of the autostart file to the config of your home directory.

$ mkdir -p ~/.config/lxsession/LXDE-pi $ cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/

  1. Edit autostart

$ sudo nano ~/.config/lxsession/LXDE-pi/autostart

Added to the end of the configuration file

@java --module-path /home/pi/samba/armv6hf-sdk/lib --add-modules=javafx.controls,javafx.fxml -jar /home/pi/samaba/test.jar

  14. Reboot and confirm automatic startup

Finally The point is to pass the path to the location of the JavaFX * .so file and put the modularization argument at runtime.

With this method, the media player gets an exception and doesn't work. Is ffmpeg not installed? I'm not sure If it goes well, I will write it again


I found another way to run JAVAFX, so I will describe it You can install bellsoft's JDK with the following command and switch with sudo update-alternatives It took me a long time to find the above method ..... Orz ...

cd /home/pi wget sudo apt-get install ./bellsoft-jdk13-linux-arm32-vfp-hflt.deb sudo update-alternatives --config javac sudo update-alternatives --config java

MP3 cannot be played with javafx of Raspberry Pi for some reason. Must be converted to wav before use This is also the reason why the media player gave an exception by the above method .... orz.orz ... I used the free RealPlayer for the conversion. Advertising is annoying ..

Recommended Posts

How to run javafx with Raspberry Pi Posted on 2020/07/12
How to run JavaFX on Docker
How to run Blazor (C #) with Docker
Serially connect to Ubuntu on Raspberry Pi
How to run NullpoMino 7.5.0 on Ubuntu 20.04.1 64bit version
Display characters on I2C 1602 LCD with Raspberry Pi 3 & Java
How to run Java EE Tutial on github on Eclipse
How to deploy on heroku
How to number (number) with html.erb
How to update with activerecord-import
Minecraft server on Raspberry Pi 4
The key to running Docker on Raspberry Pi 4 (Ubuntu server 20.04)
How to run only specific files with gem's rake test
How to run React and Rails on the same server
How to get started with JDBC using PostgresSQL on MacOS
Install MariaDB on Raspberry Pi OS
How to use PlantUML with Visual Studio Code (created on October 30, 2020)
How to execute Postgresql copy command with column information on Java
How to deploy Laravel on CentOS 7
How to get started with slim
How to run JUnit in Eclipse
Steps to run docker on Mac
How to "hollow" View on Android
How to run Ant in Gradle
How to enclose any character with "~"
How to use Ruby on Rails
How to deploy Bootstrap on Rails
Try putting CentOS 8 on Raspberry Pi 3
How to remotely debug a javaFX program executed by Raspberry Pi from Windows 10-From environment construction to debug execution ①-
Note: setting javaMail on Raspberry Pi
How to use Bio-Formats on Ubuntu 20.04
How to switch Java version with direnv in terminal on Mac
How to use mssql-tools with alpine
Create Dockerfile, docker-compose.yml and run nodejs on windows10, Linux, Raspberry Pi
How to install MariaDB 10.4 on CentOS 8
[JavaFX] [Java8] How to use GridPane
How to install WildFly on Ubuntu 18.04
How to remotely debug a javaFX program executed by Raspberry Pi from Windows 10-From environment construction to debug execution ②-
How to install Adopt OpenJDK on Debian, Ubuntu with apt (-get)
Display user-defined characters on the I2C 1602 LCD with Raspberry Pi 3 & Java
How to write when installing Amazon Corretto 8 on CentOS 8 with Ansible.
How to start Camunda with Docker
Steps to run local development of ASP.NET Core on Mac with docker-compose
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
How to crop an image with libGDX
How to check Java installed on Mac
A memorandum on how to use Eclipse
How to adjustTextPosition with iOS Keyboard Extension
How to share files with Docker Toolbox
How to compile Java with VsCode & Ant
[Java] How to compare with equals method
Headless install of Ubuntu 20.10 on Raspberry Pi
[Android] How to deal with dark themes
How to use BootStrap with Play Framework
How to detect microphone conflicts on Android
Raspberry Pi Zero with Ubuntu-style Yocto-gcc with libusb
How to switch thumbnail images with JavaScript
How to install Eclipse (Photon) on Mac
[Note] How to get started with Rspec
How to publish an application on Heroku