Reputation: 694
I try to get a working distribution of my Intellij- JavaFX- Project. In my gradle file I have:
compileJava {
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls,javafx.fxml,javafx.graphics,javafx.media'
]
println options.compilerArgs
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
I added the targetCompatibility
because when normal user install Java, they get Java 8. But when I try to build the program now, I get
Cause: error: option --add-modules not allowed with target 8
How can I add the javaFX modules without switching to Java 1.9?
Upvotes: 0
Views: 2252
Reputation: 44414
Modules do not exist in Java 8. They were introduced in Java 9. And in Java 8, you don’t need to add anything; JavaFX is part of regular Java SE 8. So your entire doFirst
block is not needed.
Upvotes: 2