如何在 EMR 集群 AWS 中使用 java runtime 11

How to use java runtime 11 in EMR cluster AWS

我在 EMR aws 中创建了一个混乱,当 spark 运行 我的应用程序时,我收到以下错误:

Exception in thread "main" java.lang.UnsupportedClassVersionError: 
com/example/demodriver/MyClassFromJAR has been compiled by a more recent version of the Java Runtime (class file version 55.0), 
this version of the Java Runtime only recognizes class file versions up to 52.0

我在集群上使用 releaseLabel emr-6.5.0 并且我的驱动程序 jar 内置于 java11

如何运行java11在EMR中应用?或者此错误与其他任何问题有关?

在最新版本的 EMR 中,安装了 java 11。要启用它,您可以提供以下配置。

[
    {
        "Classification": "spark-env",
        "Configurations": [
            {
                "Classification": "export",
                "Properties": {
                    "JAVA_HOME": "/usr/lib/jvm/java-11-amazon-corretto.x86_64"
                }
            }
        ]
    },
    {
        "Classification": "spark-defaults",
        "Properties": {
            "spark.executorEnv.JAVA_HOME": "/usr/lib/jvm/java-11-amazon-corretto.x86_64"
        }
    }
]

这似乎没有记录。

defaultJavaOptionsextraJavaOptions 可能包含 java 11 的不兼容选项,您可能仍然需要 adapt/update。