0

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:

enter image description here

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:

enter image description here

AlwaysNeedingHelp
  • 1,851
  • 3
  • 21
  • 29
  • Possible duplicated of [How to open JavaFX .jar file with JDK 11?](https://stackoverflow.com/questions/53533486/how-to-open-javafx-jar-file-with-jdk-11/53536555#53536555) – José Pereda Apr 19 '19 at 16:14

1 Answers1

1

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.

AlwaysNeedingHelp
  • 1,851
  • 3
  • 21
  • 29