Play a video using JavaFX on Raspberry Pi - javafx

I need to run a JavaFX project on Raspberry Pi (RASPBIAN JESSIE). The project includes usage of WebView and MediaView/MediaPlayer. Since Oracle does not support JavaFX on ARM platforms, I tried JavaFX port by Gluon (JavaFX Embedded SDK 8.60.8). WebView works almost perfectly. However, when I want to play a video using MediaPlayer/MediaView, I get the exception:
Error in GstPipelineFactory: can't find element for factory named qtdemux
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:497)
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:497)
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: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
at zirro.App.start(App.java:21)
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: com.sun.media.jfxmedia.MediaException: Could not create player!
at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:224)
at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:104)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
... 10 more
Any ideas how to successfully run a JavaFX application with WebView and MediaView/MediaPlayer on Raspberry Pi?

WebView and Media were never part of the JavaFX ARM distribution, but Gluon recently added it to the embedded SDK that can be downloaded from here and installed with a recent JDK for ARM, available here.
Media requires a few extra steps as it depends in the native drivers that usually are not fully installed on a regular Jessie distribution.
First install these drivers:
sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
Now edit /etc/apt/sources.list and add at the end:
deb http://ftp.uk.debian.org/debian/ wheezy main
deb-src http://ftp.uk.debian.org/debian/ wheezy main
Save the file (Ctrl+O, Ctrl+X).
Finally update and install the drivers:
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa
Now you can try to run again your JavaFX application.
If you find again the same exception (MediaException: UNKNOWN), check if it shows this message: Error in GstPipelineFactory, notice the driver that is missing, and try to install it.

I wanted to updated the correct anwser from José Pereda.
The repository for the gstreamer is not up to date. Thats the way I get it to work.
Update the /etc/apt/sources.list
deb [trusted=yes] http://archive.debian.org/debian wheezy main
deb-src [trusted=yes] http://archive.debian.org/debian/ wheezy main
And then install the dependencies.
sudo apt-get install libtag1-vanilla
sudo apt-get install libtag1-rusxmms
sudo apt-get install libtag1c2a
sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa

Related

RStudio Server (community) can't find libR.so even though it is in path

Note: I have filed this as an issue, but I'm not sure if it is really a bug or just something I need to resolve about my system configuration.
This seems to be a library that causes many people trouble with RStudio and RStudio Server. Often people can fix the problem by reinstalling the core R libraries with apt or manually copying or linking the libR.so file to a place where RStudio finds it.
In my case, I'm using a Conda instance for my R executable.
My instance was working and stopped after upgrading my ubuntu 22.04 VM. I tried some things to fix the problem but have not succeeded.
System details
RStudio Edition : Server
RStudio Version : 2022.07.2+576 (Spotted Wakerobin) for Ubuntu Bionic
OS Version : Ubuntu 22.04.1 LTS
R Version : 4.1.3 (2022-03-10) -- "One Push-Up"
Describe the problem in detail
I have a GCP VM running ubuntu 22.04 which I use for RSS.
I did a sudo apt update && sudo apt dist-upgrade and a restart. RSS stopped working. I ran sudo rstudio-server verify-installation and received
/usr/lib/rstudio-server/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory
I decided to reinstall RSS using:
wget https://download2.rstudio.org/server/jammy/amd64/rstudio-server-2022.07.2-576-amd64.deb
sudo gdebi rstudio-server-2022.07.2-576-amd64.deb
and did not receive any errors during installation. However I received the same error as above with verify-installation. I then tried doing conda update --all -y. This also did not fix the problem.
Here is some useful information:
(base) balter#rstudio:~$ which R
/home/balter/conda/bin/R
(base) balter#rstudio:~$ head -n3 /etc/rstudio/rserver.conf
# Server Configuration File
rsession-which-r=/home/balter/conda/bin/R
(base) balter#rstudio:~$ find . -name "libR.so"
./conda/lib/R/lib/libR.so
./conda/pkgs/r-base-4.1.3-h7880091_3/lib/R/lib/libR.so
(base) balter#rstudio:~$ sudo rstudio-server verify-installation
TTY detected. Printing informational message about logging configuration. Logging configuration loaded from '/etc/rstudio/logging.conf'. Logging to '/var/log/rstudio/rstudio-server/rserver.log'.
/usr/lib/rstudio-server/bin/rsession: error while loading shared libraries: libR.so: cannot open shared object file: No such file or directory

Installing Elasticsearch 6.8.15 on Apple-M1 Macbook issues

I am trying to download elasticsearch 6.8.15 for my current project. I am on a 2020 Macbook air with the M1 chip and have tried download using brew and a docker image but whenever I try to get elasticsearch to run I get a few issues.
First it appears some of the java settings are adjusted due to the M1 chip and this warning is shown:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
OpenJDK 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=0
Then I get this output which appears to be a mix of java and elasticsearch errors:
[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: org.elasticsearch.bootstrap.BootstrapException: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1 at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.18.jar:6.8.18] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.18.jar:6.8.18] Caused by: org.elasticsearch.bootstrap.BootstrapException: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1 at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:167) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18] ... 6 more Caused by: java.io.IOException: Cannot run program "/usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller": error=0, Failed to exec spawn helper: pid: 129, exit value: 1 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1142) ~[?:?] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) ~[?:?] at org.elasticsearch.bootstrap.Spawner.spawnNativeController(Spawner.java:118) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Spawner.spawnNativeControllers(Spawner.java:86) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:165) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18] ... 6 more Caused by: java.io.IOException: error=0, Failed to exec spawn helper: pid: 129, exit value: 1 at java.lang.ProcessImpl.forkAndExec(Native Method) ~[?:?] at java.lang.ProcessImpl.<init>(ProcessImpl.java:313) ~[?:?] at java.lang.ProcessImpl.start(ProcessImpl.java:244) ~[?:?] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1109) ~[?:?] at java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) ~[?:?] at org.elasticsearch.bootstrap.Spawner.spawnNativeController(Spawner.java:118) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Spawner.spawnNativeControllers(Spawner.java:86) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:165) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.18.jar:6.8.18] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.18.jar:6.8.18] ... 6 more
I have spoken with a few people on my team that have a macbook with the M1 chip and were able to install and run elasticsearch using brew. The commands they ran were:
$ brew cask install homebrew/cask-versions/adoptopenjdk8
$ brew install elasticsearch#6
$ brew services start elasticsearch#6
These commands worked fine on their machines but when I run this command I get this message:
Error: elasticsearch#6: no bottle available!
You can try to install from source with:
brew install --build-from-source elasticsearch#6
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
Found a solution with elasticsearch 7.
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
Source: https://github.com/Homebrew/discussions/discussions/925#discussioncomment-943622
elasticsearch#6 is a homebrew-core package. It depends_on "openjdk", the jdk dependency is limited to openjdk distributed by homebrew-core as well. Installing JDK outside homebrew has not effect at all.
The problem is openjdk from homebrew-core had not been built for arm64 yet. But it seems when I answer the question, the openjdk has been supported.
brew install elasticsearch#6 should work now.
Extended Reading
For anyone looking for elasticsearch 7.x. Things haven't been changed in 2021.
Homebrew stops distributing newer version of elasticsearch, and kibana, although you can still get outdated versions in homebrew-core.
It's because Homebrew defers to the OSI's open source licence definition, and the new license used by elastic softwares is not compatible with it. So, elastic begins to distribute these software with its own custom tap.
# tap maintained by elastic organization
# https://github.com/elastic/homebrew-tap
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
# brew install elastic/tap/kibina-full
# brew install elastic/tap/logstash-full

Instal devStack on Ubuntu14.04 faild

I run ./stack.sh to install OpenStack but failed with
[ERROR] ./stack.sh:198 If you wish to run this script anyway run with FORCE=yes
So I use this cmd FORCE=yes ./stack.sh to install OpenStack on Ubuntu but failed as:
[ERROR] /opt/stack/devstack/functions-common:602 git call failed: [git clone git://git.openstack.org/openstack/requirements.git /opt/stack/requirements --branch master]
I search this error but I got nothing from google, can someone help me to resolve this problem?
Many Thanks!

Is there a way to play media (.mp4) on a Raspberry Pi 3 in a JavaFX application [duplicate]

I need to run a JavaFX project on Raspberry Pi (RASPBIAN JESSIE). The project includes usage of WebView and MediaView/MediaPlayer. Since Oracle does not support JavaFX on ARM platforms, I tried JavaFX port by Gluon (JavaFX Embedded SDK 8.60.8). WebView works almost perfectly. However, when I want to play a video using MediaPlayer/MediaView, I get the exception:
Error in GstPipelineFactory: can't find element for factory named qtdemux
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:497)
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:497)
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: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)
at zirro.App.start(App.java:21)
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: com.sun.media.jfxmedia.MediaException: Could not create player!
at com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:224)
at com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:104)
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:467)
... 10 more
Any ideas how to successfully run a JavaFX application with WebView and MediaView/MediaPlayer on Raspberry Pi?
WebView and Media were never part of the JavaFX ARM distribution, but Gluon recently added it to the embedded SDK that can be downloaded from here and installed with a recent JDK for ARM, available here.
Media requires a few extra steps as it depends in the native drivers that usually are not fully installed on a regular Jessie distribution.
First install these drivers:
sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
Now edit /etc/apt/sources.list and add at the end:
deb http://ftp.uk.debian.org/debian/ wheezy main
deb-src http://ftp.uk.debian.org/debian/ wheezy main
Save the file (Ctrl+O, Ctrl+X).
Finally update and install the drivers:
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa
Now you can try to run again your JavaFX application.
If you find again the same exception (MediaException: UNKNOWN), check if it shows this message: Error in GstPipelineFactory, notice the driver that is missing, and try to install it.
I wanted to updated the correct anwser from José Pereda.
The repository for the gstreamer is not up to date. Thats the way I get it to work.
Update the /etc/apt/sources.list
deb [trusted=yes] http://archive.debian.org/debian wheezy main
deb-src [trusted=yes] http://archive.debian.org/debian/ wheezy main
And then install the dependencies.
sudo apt-get install libtag1-vanilla
sudo apt-get install libtag1-rusxmms
sudo apt-get install libtag1c2a
sudo apt-get install gstreamer0.10-plugins-good
sudo apt-get install gstreamer0.10-plugins-bad
sudo apt-get install gstreamer0.10-ffmpeg
sudo apt-get install gstreamer0.10-alsa

Aptana Studio 3 as plugin fails to startup

I have installed Eclipse 3.7.2 via PPA on Ubuntu 12.04 and subsequently I have clicked on Add New Software and the link to 64Bit Aptana studio 3.
It found the plugin and installed it correctly.
Now when I startup the Eclipse I get this error:
An internal error has occurred.
No more handlesNative code library failed to load. (java.lang.UnsatisfiedLinkError: /home/xxx/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/com.aptana.swt.webkitbrowser.linux.x86_64_1.0.0.1295409059/os/linux/x86_64/libcefjni.so: libjpeg.so.62: cannot open shared object file: No such file or directory)
UPDATE:
I wonder could it be because I am using jdk 7 from Oracle rather than Sun jdk 6 ?
This is the log file of Eclipse
!SESSION 2012-04-30 07:48:06.985 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0_04
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2012-04-30 07:48:07.951
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-gtk-3740 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/xxx/.swt/lib/linux/x86_64/libswt-gtk-3740.so
Can't load library: /home/xxx/.swt/lib/linux/x86_64/libswt-gtk.so
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
I have found the solution:
The library libjpeg62 is required otherwise the java.lang.UnsatisfiedLinkError shows up.
If using OpenJDK try this:
sudo apt-get install openjdk-7-jdk libjpeg62 libwebkitgtk-1.0-0 git-core
if using Oracle (sun) Java try this:
sudo apt-get install libjpeg62 libwebkitgtk-1.0-0 git-core
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
source
Here is a complete guide on how to install Aptana Studio 3 on Ubuntu 12.04 LTS (Precise Pangolin). The same error you encountered is mentioned with the same solution. But might be helpful for people who want to do the full installation.
http://www.samclarke.com/2012/04/how-to-install-aptana-studio-3-on-ubuntu-12-04-lts-precise-pangolin/

Resources