I generate with gradle a jar file to test my program but when I run the command :
Java -jar file_name .jar
I have always the same error:
Error: Could not find or load main class home.Main
Caused by: java.lang.ClassNotFoundException: home.Main
build.gradle :
plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile 'com.jfoenix:jfoenix:9.0.8'
}
javafx {
version = "14"
modules = [ 'javafx.controls', 'javafx.fxml']
}
jar {
manifest {
attributes(
'Class-Path': configurations.compile.files.collect {"$it.name"}.join(' '),
'Main-Class': 'home.Main')}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}