0

I am trying to package my JavaFX application into an executable fat JAR, but it never works. I have tried several guides found online including aswers here on SO but I had no luck. I can manage to set the main class correctly, but the class path is always missing, which then throws an error that JavaFx runtime components are missing. I am now using maven-shade-plugin (I have tried other plugins) and here is the configuration in pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.sjsm.App</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

Edit: as requested in the comments I am adding 3 links I used and none of them worked. Also note I have tried other sources than these over the past 2 or so weeks.

link1 link2 link3

9
  • (1) google: "javafx package maven" (2) click first hit: openjfx.io/openjfx-docs/maven Commented Oct 2, 2021 at 17:01
  • That is about creating a JavaFX project with Maven and then running it, not about packaging it into an executable jar. Commented Oct 2, 2021 at 17:36
  • Well, there's a link to the javafx-maven-plugin GitHub repo. There are some instructions on how to create an executable. Commented Oct 2, 2021 at 17:43
  • Perhaps it is worth mentioning that you no longer want to build JARs but rather full fledged launchers that include a copy of the Java runtime and all the JavaFX libraries along with your code. Commented Oct 2, 2021 at 17:49
  • Yes, instructions to jlink the application, not to create an executable jar, or am I missing somthing? Also what would be the advantage of creating an application with jlink compared to creating a fat jar other than having a fully contained application? But that's getting off topic. Commented Oct 2, 2021 at 18:18

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.