B4J Question Rasberry Pi Mediaview Error

Peter Lewis

Well-Known Member
Licensed User
Longtime User
Hi,
I have followed all the installation of Java and Openfx found on the forum but when I run it I get this error
djpeterlewis@ledposter:~/Downloads $ sudo java -jar --module-path /usr/share/openjfx/lib --add-modules javafx.controls -jar ledposterplayer.jar
main._appstart (java line: 63)
java.lang.RuntimeException: java.lang.ClassNotFoundException: javafx$scene$media$MediaView
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4j.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:85)
at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:109)
at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
at b4j.ledposter.main._appstart(main.java:63)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.ledposter.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ClassNotFoundException: javafx$scene$media$MediaView
at anywheresoftware.b4j.object.JavaObject.getCorrectClassName(JavaObject.java:289)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:84)
at b4j.ledposter.mediaview._designercreateview(mediaview.java:133)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 18 more

djpeterlewis@ledposter:~/Downloads $
Java Version is

djpeterlewis@ledposter:~ $ sudo java --version
openjdk 21.0.10 2026-01-20
OpenJDK Runtime Environment (build 21.0.10+7-Debian-1deb13u1)
OpenJDK 64-Bit Server VM (build 21.0.10+7-Debian-1deb13u1, mixed mode, sharing)
djpeterlewis@ledposter:~ $

and Open Javafx is at

djpeterlewis@ledposter:~ $ dpkg-query -L openjfx
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/openjfx
/usr/share/doc/openjfx/TODO.Debian
/usr/share/doc/openjfx/changelog.Debian.gz
/usr/share/doc/openjfx/copyright
/usr/share/openjfx
/usr/share/openjfx/lib
/usr/share/openjfx/lib/javafx.properties
/usr/share/openjfx/lib/javafx.base.jar
/usr/share/openjfx/lib/javafx.controls.jar
/usr/share/openjfx/lib/javafx.fxml.jar
/usr/share/openjfx/lib/javafx.graphics.jar
/usr/share/openjfx/lib/javafx.media.jar
/usr/share/openjfx/lib/javafx.swing.jar
/usr/share/openjfx/lib/javafx.web.jar
djpeterlewis@ledposter:~ $
I also did the codec updates

sudo apt-get install libavcodec-extra libavformat-extra
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libavcodec-extra61 libavformat-extra61
Suggested packages:
libcuda1 libnvcuvid1 libnvidia-encode1
The following packages will be REMOVED:
libavcodec61 libavformat61
The following NEW packages will be installed:
libavcodec-extra libavcodec-extra61 libavformat-extra libavformat-extra61
0 upgraded, 4 newly installed, 2 to remove and 0 not upgraded.
Need to get 8,814 kB of archives.
After this operation, 253 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://archive.raspberrypi.com/debian trixie/main arm64 libavformat-extra61 arm64 8:7.1.3-0+deb13u1+rpt1 [1,466 kB]
Get:2 http://archive.raspberrypi.com/debian trixie/main arm64 libavcodec-extra61 arm64 8:7.1.3-0+deb13u1+rpt1 [7,230 kB]
Get:3 http://archive.raspberrypi.com/debian trixie/main arm64 libavcodec-extra arm64 8:7.1.3-0+deb13u1+rpt1 [58.9 kB]
Get:4 http://archive.raspberrypi.com/debian trixie/main arm64 libavformat-extra arm64 8:7.1.3-0+deb13u1+rpt1 [58.9 kB]
Fetched 8,814 kB in 3s (3,398 kB/s)
dpkg: libavformat61:arm64: dependency problems, but removing anyway as you requested:
vlc-plugin-base:arm64 depends on libavformat61 (>= 7:7.0).
rpicam-apps-encoder:arm64 depends on libavformat61 (>= 7:7.0).
python3-av depends on libavformat61 (>= 7:7.0).
libavfilter10:arm64 depends on libavformat61 (>= 7:7.0).
libavdevice61:arm64 depends on libavformat61 (= 8:7.1.3-0+deb13u1+rpt1).
gstreamer1.0-libav:arm64 depends on libavformat61 (>= 7:7.0).
ffmpeg depends on libavformat61 (>= 7:7.0).

(Reading database ... 143046 files and directories currently installed.)
Removing libavformat61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Selecting previously unselected package libavformat-extra61:arm64.
(Reading database ... 143040 files and directories currently installed.)
Preparing to unpack .../libavformat-extra61_8%3a7.1.3-0+deb13u1+rpt1_arm64.deb ...
Unpacking libavformat-extra61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
dpkg: libavcodec61:arm64: dependency problems, but removing anyway as you requested:
vlc-plugin-base:arm64 depends on libavcodec61 (>= 7:7.1).
rpicam-apps-encoder:arm64 depends on libavcodec61 (>= 7:7.1).
python3-av depends on libavcodec61 (>= 7:7.0).
libneatvnc0:arm64 depends on libavcodec61 (>= 7:7.0).
libavformat-extra61:arm64 depends on libavcodec61 (= 8:7.1.3-0+deb13u1+rpt1).
libavfilter10:arm64 depends on libavcodec61 (= 8:7.1.3-0+deb13u1+rpt1).
libavdevice61:arm64 depends on libavcodec61 (>= 7:7.0).
gstreamer1.0-libav:arm64 depends on libavcodec61 (>= 7:7.1).
ffmpeg depends on libavcodec61 (>= 7:7.1).

(Reading database ... 143047 files and directories currently installed.)
Removing libavcodec61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Selecting previously unselected package libavcodec-extra61:arm64.
(Reading database ... 143040 files and directories currently installed.)
Preparing to unpack .../libavcodec-extra61_8%3a7.1.3-0+deb13u1+rpt1_arm64.deb ...
Unpacking libavcodec-extra61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Selecting previously unselected package libavcodec-extra:arm64.
Preparing to unpack .../libavcodec-extra_8%3a7.1.3-0+deb13u1+rpt1_arm64.deb ...
Unpacking libavcodec-extra:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Selecting previously unselected package libavformat-extra:arm64.
Preparing to unpack .../libavformat-extra_8%3a7.1.3-0+deb13u1+rpt1_arm64.deb ...
Unpacking libavformat-extra:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Setting up libavcodec-extra61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Setting up libavformat-extra61:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Setting up libavformat-extra:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Setting up libavcodec-extra:arm64 (8:7.1.3-0+deb13u1+rpt1) ...
Processing triggers for libc-bin (2.41-12+rpt1+deb13u1) ...


I had to put the media in the same folder as the media could not be found but it looks like the mediaplayer class could not be found

There were some notes along the way to install a 32 bit operating system which entails starting over again. Would this solve it ?

Thank you
 
Last edited:

Peter Lewis

Well-Known Member
Licensed User
Longtime User
The installed JavaFX is probably missing MediaView functionality. Have you tried to run the program with B4J-Bridge?
I have tried it, first it gave an error as it wanted the media in the tempjars folder

Then it gave me this error

mediaview._setsource (java line: 302)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:91)
at b4j.ledposter.mediaview._setsource(mediaview.java:302)
at b4j.ledposter.main._appstart(main.java:77)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.ledposter.main.start(main.java:37)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWai
t$12(PlatformImpl.java:483)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java:263)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:147)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:518)
at javafx.media/javafx.scene.
media.MediaPlayer.<init>(MediaPlayer.java:421)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 19 more
Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:299)
at javafx.media/com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:474)
... 21 more
Which it looks like it has a problem with creating the MediaView.

Somehow the Bridge shows the modules are loaded

1769934096746.png
 
Upvote 0

Peter Lewis

Well-Known Member
Licensed User
Longtime User
The installed JavaFX is probably missing MediaView functionality. Have you tried to run the program with B4J-Bridge?

I also tried this which was the suggestion from the Pi forum

32 bit isn't going to help you. You don't post the code for the openjfx install but I looked at my computer and the latest openjfx in the repository is 11.0.11. You've got Java 21 installed. Not sure that is your problem but they should match versions. The latest openjdk in the repository is version 25. I would suggest you get the latest JDK.

I use a JDK that includes JavaFX. Go to bell-sw.com and download the latest version Liberica JDK 25.0.2 Full for Linux ARM. The Full means it includes OpenJFX. You don't need any of the module declarations on the command line to compile or run JavaFX programs then.

If you don't want to go the easy root, go here: https://gluonhq.com/products/javafx/ and download the latest OpenJFX version to match your JDK.

I'm not sure why the openjfx in the repository is so out of date.

Get the Liberica JDK 25.0.2 Full for ARM and report back.

So I have installed ver 25 FULL which should include jFX

djpeterlewis@ledposter:~/Downloads $ java -version
openjdk version "25.0.2" 2026-01-20 LTS
OpenJDK Runtime Environment (build 25.0.2+12-LTS)
OpenJDK 64-Bit Server VM (build 25.0.2+12-LTS, mixed mode, sharing)

but i still get this error in B4J over the bridge

WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
WARNING: package com.sun.glass.ui.win not in javafx.graphics
WARNING: package com.sun.prism.d3d not in javafx.graphics
WARNING: Unknown module: javafx.swt specified to --add-opens
Waiting for debugger to connect...
Program started.
Error occurred on line: 61 (MediaView)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(JavaObject.java:91)
at b4j.ledposter.mediaview._setsource(mediaview.java:69)
at b4j.ledposter.main._appstart(main.java:106)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.M
ethod.invoke(Method.java:580)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.ledposter.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$10(GtkApplication.java
:263)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:147)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:518)
at javafx.media/javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:421)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 25 more
Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaManager.getPlayer(NativeMediaManager.java:299)
at javafx.media/com.sun.media.jfxmedia.MediaManager.getPlayer(MediaManager.java:118)
at javafx.media/javafx.scene.media.MediaPlayer.init(MediaPlayer.java:474)
... 27 more
 
Upvote 0

Peter Lewis

Well-Known Member
Licensed User
Longtime User
This is the error message: Caused by: com.sun.media.jfxmedia.MediaException: Could not create player!

It happens inside JavaFX.
I tried to run it now that i updated as per the Raspbery Pi Forum and it does almost perfectly on the Raspberry Pi but not through the bridge. There are some errors on certain functions

b4x_transition$ResumableSub_PrepareTransition_BurnOut.resume (java line: 262)
java.lang.IllegalAccessError: class anywheresoftware.b4a.objects.B4XCanvas$B4XPath (in unnamed module @0x1fc41a9) cannot access class com.sun.javafx.geom.Path2D (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.geom to unnamed module @0x1fc41a9
at anywheresoftware.b4a.objects.B4XCanvas$B4XPath.InitializeRoundedRect(B4XCanvas.java:381)
at b4j.ledposter.b4x_transition$ResumableSub_PrepareTransition_BurnOut.resume(b4x_transition.java:262)
at b4j.ledposter.b4x_transition._preparetransition_burnout(b4x_transition.java:42)
at b4j.ledposter.main._clickpanel1(main.java:261)
at b4j.ledposter.main$ResumableSub_dostart.resume(main.java:510)
at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1104)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$4(PlatformImpl.java:424)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$1(GtkApplication.java:242)
at java.base/java.lang.Thread.run(Thread.java:1474)


(java:3433): Gdk-WARNING **: 11:43:37.745: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.

but will not work through the bridge at all
 
Upvote 0
Top