Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not start javafx project #114

Closed
abdullanablsi opened this issue Sep 14, 2019 · 3 comments
Closed

can not start javafx project #114

abdullanablsi opened this issue Sep 14, 2019 · 3 comments

Comments

@abdullanablsi
Copy link

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

@sharidass1408
Copy link

sharidass1408 commented Sep 24, 2019

I am facing the same issue in my project after generating the Jar file using gradle.

plugins {
id 'java'
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.8'
}

group 'com.ltdrive'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
mavenCentral()
maven {
url 'http://www.nexus.ford.com/repository/thirdparty'
}
maven {
url 'https://mvnrepository.com/artifact/com.hynnet/jacob'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
}

dependencies {
compile group: 'org.apache.poi', name: 'poi', version: '4.1.0'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.0'
compile group: 'net.sf.ucanaccess', name: 'ucanaccess', version: '4.0.4'
compile group: 'com.hynnet', name: 'jacob', version: '1.18'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'com.j2html', name: 'j2html', version: '1.4.0'
//compile group: 'org.openjfx.javafxplugin', name: 'org.openjfx.javafxplugin.gradle.plugin', version: '0.0.8', ext: 'pom'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

javafx {
version = "13"
modules = [ 'javafx.controls', 'javafx.fxml']
}

jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes (
'Implementation-Title' : 'Jar Making Example',
'Main-Class': 'javafxltdrive.JavaFxLTDrive'
)

}

exclude("**/**.SF")
exclude("**/**.RSA")
exclude("**/**.DSA")

destinationDirectory = file("$rootDir/my-jar")
archivesBaseName = 'LTDrive'

}

mainClassName = 'javafxltdrive.JavaFxLTDrive'

@ToORAGe
Copy link

ToORAGe commented Sep 24, 2019

Have the same issue, using Adopt OpenJDK and OpenJFX.

@jperedadnr
Copy link
Contributor

@sharidass1408 your jar task should use configurations.runtimeClasspath, as now the JavaFX plugin uses implementation instead of the deprecated compile (that is why configurations.compile doesn't include the JavaFX classes in the fat jar).

The docs/sample already contain this change. See for instance this build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants