Exporting JavaFX Project with Maven (IntelliJ IDEA)

Viewed 226

I've been struggling with this for the past few hours, and I can't seem to find a way to export this properly.

Error: Could not find or load main class me.mrbakbuki.app.Main Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

Relevant part from my pom.xml file:

<build>
    <plugins>
        <plugin>
            <groupId>com.zenjava</groupId>
            <artifactId>javafx-maven-plugin</artifactId>
            <version>8.8.3</version>
            <configuration>
                <mainClass>gui.Main</mainClass>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>me.mrbakbuki.app.Main</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>

I want to export this as an executable jar file Any help appreciated

1 Answers

You need to run your jar with Java 8 because it comes with JavaFX. I had the same problem a while ago and running the jar with Java 8 solved it for me.

Related