简体   繁体   English

IntelliJ JavaFX 12工件:没有主要的清单属性,但它有吗?

[英]IntelliJ JavaFX 12 Artifact: no main manifest attribute, but it is there?

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 . 我从这里克隆了IntelliJ gradle non-moduler hellofx示例应用程序。

Builds and runs okay, good. 构建并运行良好,良好。

I then tried to build an artifact. 然后我尝试构建一个工件。 I did Add -> JAR -> from modules with dependencies... Add -> JAR -> from modules with dependencies...做了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: 但Main-Class属性在正在建设的工件时产生的清单文件:

在此输入图像描述

Fixed it with help from Jose's answer here . 与荷西的回答帮助修好了这里

I had to add the native libs from the bin folder from javaFX. 我不得不从javaFX的bin文件夹中添加本机库。

I had to take extra steps because building with gradle wasn't putting the fxml and class files together in the build. 我不得不采取额外的步骤,因为使用gradle构建并没有将fxml和类文件放在构建中。 So I had to add this to my build.gradle: 所以我不得不将它添加到我的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. 此外,我不得不将META-INF文件夹移动到资源文件夹中,因此在构建它时将其放置在正确的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM