B4J Question B4JPackager11 Error With MediaPlayer, jAudioClip [SOLVED]

jmon

Well-Known Member
Licensed User
Hello,
As the title says, I have errors with jAudioClip when compiling an exe with B4JPackager11 or Windows. I also tried with MediaPlayer, and get the same error when running the exe.

With MediaPlayer:
main._appstart (java line: -1)
java.lang.UnsupportedOperationException: Unsupported protocol "jrt"
at javafx.media/com.sun.media.jfxmedia.locator.Locator.<init>(Unknown Source)
at javafx.media/javafx.scene.media.Media.<init>(Unknown Source)
at b4j/anywheresoftware.b4j.objects.MediaPlayerWrapper.Initialize(Unknown Source)
at b4j/com.xxxx.xxxxx.main._appstart(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent(Unknown Source)
at b4j/com.jmontserrat.postchatclient.main.start(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
With jAudioClip:
main._appstart (java line: -1)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at b4j/anywheresoftware.b4j.object.JavaObject.InitializeNewInstance(Unknown Source)
at b4j/b4j.example.audioclip._create(Unknown Source)
at b4j/b4j.example.audioclip_static._newaudioclip(Unknown Source)
at b4j/com.xxxx.xxxxx.main._appstart(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent2(Unknown Source)
at b4j/anywheresoftware.b4a.BA.raiseEvent(Unknown Source)
at b4j/com.jmontserrat.postchatclient.main.start(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: Unsupported protocol "jrt"
at javafx.media/com.sun.media.jfxmedia.locator.Locator.<init>(Unknown Source)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaAudioClip.<init>(Unknown Source)
at javafx.media/com.sun.media.jfxmediaimpl.NativeMediaAudioClip.load(Unknown Source)
at javafx.media/com.sun.media.jfxmediaimpl.AudioClipProvider.load(Unknown Source)
at javafx.media/com.sun.media.jfxmedia.AudioClip.load(Unknown Source)
at javafx.media/javafx.scene.media.AudioClip.<init>(Unknown Source)
... 24 more
Both errors are related to "Unsupported protocol "jrt"". I couldn't find anything relevant on internet. My App runs fine in Release, Debug modes, or as a Jar, but the error happens when running the exe.

Thank you for your help.

EDIT: Solution: The Exe cannot access the audio or video files in File.DirAssets. Copy your files to File.DirApp or File.DirData.
 
Last edited:
Top