I am using JRE 1.9.0 (9.0.4+ 11). I'm trying to create an executable JAR. After I export to JAR with Maven and try to launch it, I get the following error:
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: com/sun/javafx/css/converters/SizeConverter at org.kordamp.ikonli.javafx.FontIcon$StyleableProperties.(FontIcon.java:265) at org.kordamp.ikonli.javafx.FontIcon.getClassCssMetaData(FontIcon.java:321) at org.kordamp.ikonli.javafx.FontIcon.getCssMetaData(FontIcon.java:325) at javafx.graphics/javafx.scene.CssStyleHelper$CacheContainer.(Unknown Source) at javafx.graphics/javafx.scene.CssStyleHelper$CacheContainer.(Unknown Source) at javafx.graphics/javafx.scene.CssStyleHelper.createStyleHelper(Unknown Source) at javafx.graphics/javafx.scene.Node.reapplyCss(Unknown Source) at javafx.graphics/javafx.scene.Node.reapplyCSS(Unknown Source) at javafx.graphics/javafx.scene.Node.invalidatedScenes(Unknown Source) at javafx.graphics/javafx.scene.Node.setScenes(Unknown Source) at javafx.graphics/javafx.scene.Parent$2.onChanged(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.css.converters.SizeConverter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source) at java.base/java.lang.ClassLoader.loadClass(Unknown Source) ... 103 more
This is happening on the same machine where I exported the JAR from. It works fine when launched from IDE and I suppose my IDE (Eclipse) uses the same JRE as Windows does when launching my JAR since it's the only one I have installed. Libraries I have included with Maven are ikonli 2.3.0 and jfoenix 9.0.8.
I also tried to wrap that same JAR with Launch4J and I ran into the same problem.
Here's build from my pom.xml file
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.project.Main</mainClass>
</transformer>
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>
com.project.Main
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>