I'm trying to create a jar-file for my JavaFX project but I cant't seem to get it to work. Depending on what I do I get a mix of two different errors:
Error: Could not find or load main class mapsRUs.MapsRUs
& Error: JavaFX runtime components are missing, and are required to run this application
. With this configuration it's the first of the two.
My build.gradle looks like this:
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.7'
}
javafx {
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
applicationDefaultJvmArgs = ["-Xmx4g"]
mainClassName = 'mapsRUs.MapsRUs'
dependencies {
compile 'com.google.guava:guava:23.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.2'
// Use JUnit test framework
testCompileOnly 'junit:junit:4.12'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.3.1'
}
repositories {
jcenter()
}
test {
useJUnitPlatform()
}
jar {
baseName = "Maps R Us"
manifest {
attributes 'Main-Class': mainClassName
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
The manifest file generated by the jar-task looks like this:
Manifest-Version: 1.0
Main-Class: mapsRUs.MapsRUs
My main class includes this (it has some more things unimportant to this topic):
public class MapsRUs extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
... some code ...
}
Can anyone figure out what is wrong here? Thanks in advance!