0

I created a simple module based HelloWorld JavaFx application with maven. When I start it using maven javafx:run it works just fine with no warnings. Then I want to create an uber jar with the help of maven-shade-plugin. Here is a part of pom.xml :

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.3</version>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                    <goal>shade</goal>
                </goals>
                <configuration>
                    <transformers>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <mainClass>Launcher</mainClass>
                        </transformer>
                    </transformers>
                </configuration>
            </execution>
        </executions>
    </plugin>

If I run this jar with java -jar app.jar I get the following warning on console :

PM com.sun.javafx.application.PlatformImpl startup
WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @48f63233'

I found out that it could be just ignored but I wonder if it is possible to fix it. Any suggestions?

Dmitry
  • 1,912
  • 2
  • 18
  • 29
  • "_but I wonder if it is possible to fix it_" – Yes, it's fixable. The solution is to place the JavaFX modules on the module-path and then make sure those modules are actually resolved. This precludes the use of so-called uber JAR files for a couple reasons: (1) The Java launcher places the JAR specified with `-jar` on the class-path, and (2) the JAR file specification only allows one module per JAR file. I recommend considering a different deployment strategy. Look at the "Packaging" section of the FAQ's in the [JavaFX tag info](https://stackoverflow.com/tags/javafx/info) page for ideas. – Slaw Oct 09 '22 at 05:57

0 Answers0