B4J Question java.lang.NoClassDefFoundError: javafx/embed/swing/SwingFXUtils

Angelo Messina

Active Member
Licensed User
Longtime User
Hi, I have to run an app that I wrote with B4J which works great in Windows 11 but as soon as I run the .jar on the iMac I get this error only when I select the option to save an image to a .png file via img.WriteToStreamm( out,100, "PNG")
compiled with jdk.14.0.1 and run with javafx 22.0.1

error:
main._imagetobytes (java line: 382)
java.lang.NoClassDefFoundError: javafx/embed/swing/SwingFXUtils
    at anywheresoftware.b4j.objects.ImageViewWrapper$ImageWrapper.WriteToStream(ImageViewWrapper.java:199)
    at anywheresoftware.b4a.objects.B4XViewWrapper$B4XBitmapWrapper.WriteToStream(B4XViewWrapper.java:839)
    at com.AngeloMessina.main._imagetobytes(main.java:382)
    at com.AngeloMessina.main._button3_click(main.java:370)
    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$1.run(BA.java:236)
    at javafx.graphics@22.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at javafx.graphics@22.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
    at javafx.graphics@22.0.1/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.SwingFXUtils
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
    ... 12 more

can you help me solve it? Thank you
 
Top