JavaFX Preloader: Expected static method javafx.graphics/com.sun.javafx.iio.ImageStorage.addImageLoaderFactory

In order to create a native image with GraalVM I must first create a lib-agent.
I use this command line:

java -agentlib:native-image-agent=config-output-dir="META-INF/native-image" --module-path %MODULE_PATH% --add-modules ALL-DEFAULT,ALL-SYSTEM,ALL-MODULE-PATH --add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED --add-exports javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED -cp "classes;lib/*" app.Main

But I get this error :

Exception in Preloader start method
Exception in thread "main" java.lang.RuntimeException: Exception in Preloader start method
        at [email protected]/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
        at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IncompatibleClassChangeError: Expected static method 'void com.sun.javafx.iio.ImageStorage.addImageLoaderFactory(com.sun.javafx.iio.ImageLoaderFactory)'
        at de.codecentric.centerdevice.javafxsvg.SvgImageLoaderFactory.install(SvgImageLoaderFactory.java:15)
        at app.internal.view.preloader.FxAppPreloader.start(FxAppPreloader.java:114)
        at [email protected]/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$7(LauncherImpl.java:761)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at [email protected]/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
        at [email protected]/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
        ... 1 more

According to various solutions on the internet I tried to compile the program and use other commands like –enable-native-access but this gave no change.

Thanks you in advance for your responses !

This has nothing to do with Graal or JavaFX Preloaders.

The library you are using (javafxsvg) hasn’t been updated in six years and is incompatible with modern JavaFX versions.

The method being invoked by the library:

  • public void addImageLoaderFactory(ImageLoaderFactory factory)

is not a publicly supported JavaFX API, so it is subject to change at any time without notification.

The addImageLoaderFactory method is not a static method (as the javafxsvg library is currently coded to assume). The ImageStorage class uses a Singleton instance pattern instead. The code was changed as part of JDK-8277572 ImageStorage should correctly handle MIME types for images encoded in data URIs

Potential Fixes

To address your error, you need to use a different library to accomplish the same functionality (SVG display in JavaFX). I have no advice on other SVG libraries for JavaFX with similar functionality.

Or copy the library code yourself, fix it to work with modern JavaFX versions, and rebuild it.

Alternatively, you could try to find a version of JavaFX that is compatible with your library choice (perhaps JavaFX 17).

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật