I created artifacts and when starting the program I get the error Class com.abstudio.fakture.MainActivity not found. When I run a program through the IDE it does everything right.
IDE: Intelij IDEA JavaFX Java 8
Manifest file:
Manifest-Version: 1.0
Main-Class: com.abstudio.fakture.MainActivity
MainActivity is in path: src/main/java/com/abstudio/fakture/MainActivity
When in cmd I run the command "jar tf ePDV.jar" i see that the com/abstudio/fakture/MainActivity path is compiled with other classes, interfaces, etc.
My build.gradle file:
plugins {
id 'java'
id 'application'
id 'idea'
}
sourceCompatibility = JavaVersion.VERSION_1_8
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar {
manifest {
attributes(
'Main-Class': 'com.abstudio.fakture.MainActivity'
)
}
}
sourceSets.main {
java {
srcDir 'src/main/java' //assume that your source codes are inside this path
}
resources {
srcDirs = ['src/main/java', 'src/main/resources']
exclude "**/*.java"
}
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation 'com.jfoenix:jfoenix:8.0.10'
implementation group: 'de.jensd', name: 'fontawesomefx', version: '8.1'
// https://mvnrepository.com/artifact/mysql/mysql-connector-java
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
// https://mvnrepository.com/artifact/com.itextpdf/itextpdf
implementation group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13.2'
implementation group: 'org.apache.derby', name: 'derby', version: '10.14.1.0'
// https://mvnrepository.com/artifact/org.controlsfx/controlsfx
implementation group: 'org.controlsfx', name: 'controlsfx', version: '8.40.18'
implementation 'org.apache.commons:commons-configuration2:2.7'
implementation 'commons-io:commons-io:2.11.0'
implementation 'commons-net:commons-net:3.8.0'
}
mainClassName = 'com.abstudio.fakture.MainActivity'
In project structures Application class is com.abstudio.fakture.MainActivity
How to solve this problem? Thanks
One way to address this is to simply start over from scratch using an alternate method.
This is not an easy task, but will probably give a decent outcome if you can manage it:
Because you are sharing similar libraries, also see:
Which has info on the library versions to use and recommended dev approach (a lot of the info in the answer is relevant to you, regardless of whether you use SceneBuilder on not).