javafx applications not showing org.kordamp.materialdesign2 icons
I recently completed a school management program with JavaFX 18 which runs properly using the normal IntelliJ run configurations but fails to load ALL icons from org.kordamp.materialdesign2. I have scanned the entire web and come across a few answers regarding service files. I have all three required packages in my module-info file org.kormap.ikoli.core,org.kordamp.javafx and org.kordamp.materialdesign2
When the jar is run, it shows messages like this:
Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException: Cannot resolve 'mdi2o-office-building'
at org.kordamp.ikonli.AbstractIkonResolver.resolve(AbstractIkonResolver.java:61)
at org.kordamp.ikonli.javafx.IkonResolver.resolve(IkonResolver.java:73)
at org.kordamp.ikonli.javafx.FontIcon.lambda$new$2(FontIcon.java:76)
at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
at javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82)
at org.kordamp.ikonli.javafx.FontIcon.setIconCode(FontIcon.java:231)
at org.kordamp.ikonli.javafx.FontIcon.<init>(FontIcon.java:97)
at manager.school_manager.EntryController.initialize(EntryController.java:115)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at manager.school_manager.Entry.start(Entry.java:56)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:1589)
error messages on running jar | Program without icons on running jar | Program showing icons when run in intellij
module-info.java with all three co-dependencies
Tried using the shadow jar plugin as stated in it's documentation
build.gradle file showing use of shadow jar plugin
Also opened the jar file with winrar and checked the Manifest/Manifest.MF/services and here is what I found:
Example app
Build requires Maven installation and JDK 20 installation. Deployment is standalone and has no dependencies other than the OS it runs on.
src/main/java/module-info.javapom.xmlsrc/main/java/com/example/materialicons/IconApplication.javaMaterial Design has icon packs, named A -> Z. We just use the A icon pack here, usage of icons from other packs is similar.
Build
Build command (execute from the project root directory):
Build output:
Example usage
Execute from your project root directory. Adjust the command syntax for your OS type.
Example output