Perhaps quite a few people are looking for a way to run JAVA FX on Rasppies, but I have a little information in Japanese, so I’ll abbreviate it here.
The following articles are the most interesting when I search with Google Sensei. https://qiita.com/sh1k1ya/items/72d40e6ef8b8cd51e68c “I tried combining JavaFX and GPIO control on the Raspberry Pi… but orz is not yet complete.”
I referred to it, but it did not work easily
Development tool uses Eclipse The method of introducing JAVAFX into Eclipse and developing it will be transferred to other sites.
$/sudo apt-get install samaba5.smb.conf edit
sudo nano /etc/samba/smb.confAdd to the last line
[raspberry_pi] comment = Share path = /home/pi/samba public = yes read only = no browsable = yes force user = pi6. Create a samba folder in /home/pi
$ sudo mkdir /home/pi/samba7. Service start * It will be automatically started when the Raspberry Pi is started next time.
$ sudo systemctl restart smbd8. Placement of javafx ・Https://openjfx.io/ ・Download JavaFX armv6hf SDK and decompress ZIP - Place the unzipped files in the samba folder Right-click armv6hf-sdk Open on terminal ・Permission confirmation -Pass the path * You can execute the javaFX so file by passing the path
\$ export PATH="$PATH:/home/pi/samba/armv6hf-sdk"―― ・Pass confirmation
/$ echo PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/pi/ samba/armv6hf-sdk9. Place an executable jar containing appropriate JAVAFX in samba (Example) -It can be executed by typing the following in 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 build a javaFX project in Eclipse1.javaFX-Create a javaFX project 2. Enter the project name 3. Add JAVAFX11 of user library by adding library 4. Set the JAVA FX11 native live library location (Example) C:\javafx-sdk-11.0.2\bin 5. Select FXML as declarative UI language Change the name etc. 6. Complete Edit 7.XXX.fxml with Scene Builder Enter the code in XXXXController.java 8. Use java8 as the execution environment h. You may use java13, but you need to declare modularization in the command line argument. 9. Create executable jar JAVAFX11 of user library needs to be packaged 10. Place it in /home/pi/samba and give it execution permission *Direct output 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.jar12. Automatic startup settings Execute the following command to copy the template of the autostart file to the config of the home directory
$ mkdir -p ~/.config/lxsession/LXDE-pi $ cp /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/13. Edit autostart
$ sudo nano ~/.config/lxsession/LXDE-pi/autostart
Add to the end of the setting 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
FinallyThe point is to pass the path where the JavaFX *.so file is located and put the modularization argument at runtime. With this method, mediaplayer gets an exception and does not work. Is ffmpeg not installed? Don't know If successful, list again
2020/7/14A method to move JAVA FX has been found separately, 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 while to find the above method.....Orz...
cd /home/pi wget https://download.bell-sw.com/java/13/bellsoft-jdk13-linux-arm32-vfp-hflt.deb sudo apt-get install ./bellsoft-jdk13-linux-arm32-vfp-hflt.deb sudo update-alternatives --config javac sudo update-alternatives --config java