I build my project using gradle jar command, then try to start my application using command java -jar MyProject.jar
After that I have error:
Error: Could not find or load main class org.apdalgo.Main<br>
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
My build.gardle:
plugins { id 'java' id 'application' id 'org.openjfx.javafxplugin' version '0.0.7' } group 'org.apdalgo' version '1.0-SNAPSHOT' sourceCompatibility = 11 repositories { mavenCentral() } dependencies { testCompile group: 'junit', name: 'junit', version: '4.12' } javafx { version = "12" modules = [ 'javafx.controls', 'javafx.fxml' ] } mainClassName = 'org.apdalgo.Main' jar { manifest { attributes 'Main-Class': 'org.apdalgo.Main', 'Class-Path': configurations.runtime.files.collect { "lib/$it.name" }.join(' ') } from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } }