JavaFXPlugin 编译错误(Java 版本)

2022-09-03 04:55:30

我正在尝试在此处运行 ArcGIS github 中的一些示例代码。

当我导入并尝试在IntelliJ Community 2019中运行该项目时,我收到一个错误:

原因:org/openjfx/gradle/JavaFXPlugin 已由较新版本的 Java 运行时编译(类文件版本 55.0),此版本的 Java 运行时只能识别高达 52.0 的类文件版本

My build.gradle:

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

ext {
    arcgisVersion = '100.6.0'
}

repositories {
    jcenter()
    maven {
        url 'https://esri.bintray.com/arcgis'
    }
}

configurations {
    natives
}

dependencies {
    compile "com.esri.arcgisruntime:arcgis-java:$arcgisVersion"
    natives "com.esri.arcgisruntime:arcgis-java-jnilibs:$arcgisVersion"
    natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

javafx {
    version = "11.0.1"
    modules = [ 'javafx.controls' ]
}

task copyNatives(type: Copy) {
    description = "Copies the arcgis native libraries into the .arcgis directory for development."
    group = "build"
    configurations.natives.asFileTree.each {
        from(zipTree(it))
    }
    into "${System.properties.getProperty("user.home")}/.arcgis/$arcgisVersion"
}

run {
    dependsOn copyNatives
    mainClassName = 'com.mycompany.app.App'
}

wrapper {
    gradleVersion = '5.0'
}

到目前为止,我尝试过什么

我已经下载了Java 11 SDK并安装了它。我将IntelliJ中的Java版本更改为11。

enter image description here

即使在更改为Java 11后,该错误仍然存在。

更新

运行配置窗口不允许我选择 java 版本:

enter image description here

类似的问题在这里 - 但没有答案。

如何修复此错误?


答案 1

多亏了CrazyCoder,我找到了答案。我不得不在Intellij中设置JDK版本

文件>设置>构建、执行、部署>构建工具>材质

.

enter image description here


答案 2

推荐