Reputation: 1955
Little confused here. Looked around and haven't found anything. Lots of people seem to be having similar problems but I haven't seen a solution yet.
I cloned the IntelliJ gradle non-moduler hellofx sample application from here.
Builds and runs okay, good.
I then tried to build an artifact. I did Add -> JAR -> from modules with dependencies...
Resulting in:
Building the artifact and trying to run it gives me the following error:
"C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -Dfile.encoding=windows-1252 -jar E:\hellofx\out\artifacts\hellofx_main_jar\hellofx_main.jar
no main manifest attribute, in E:\hellofx\out\artifacts\hellofx_main_jar\hellofx_main.jar
But the Main-Class attribute is in the manifest file that was generated when building the artifact:
Upvotes: 0
Views: 709
Reputation: 1955
Fixed it with help from Jose's answer here.
I had to add the native libs from the bin folder from javaFX.
I had to take extra steps because building with gradle wasn't putting the fxml and class files together in the build. So I had to add this to my build.gradle:
plugins {
//...
id 'idea'
}
sourceSets.main.output.resourcesDir = "build/classes/java/main"
idea {
module.outputDir file("out/production/classes")
}
In addition I had to move the META-INF folder into the resource folder so when building it was placed in the correct location.
Upvotes: 1