【问题标题】:Change Java Runtime Version in Intellij Idea在 Intellij Idea 中更改 Java 运行时版本
【发布时间】:2022-01-07 08:16:48
【问题描述】:

我正在将使用 ktor 构建的服务器部署到 Heroku,但是当我运行命令时 heroku open我收到应用程序错误

以下显示在日志中

Exception in thread "main" java.lang.UnsupportedClassVersionError:com/zaxxer/hikari/HikariConfig 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

当我运行heroku run java -version 我收到了这个

openjdk version "1.8.0_312-heroku"
OpenJDK Runtime Environment (build 1.8.0_312-heroku-b05)
OpenJDK 64-Bit Server VM (build 25.312-b05, mixed mode)

如何在 Intellij idea

中更改 Java 运行时版本

【问题讨论】:

    标签: java heroku intellij-idea


    【解决方案1】:

    您需要更改部署应用程序的 Heroku 上的 Java 版本(默认情况下,Heroku 提供 Java 8,您已正确验证)。

    在项目根目录中放置一个文件system.properties,其中包含:

    java.runtime.version=11
    

    【讨论】:

      【解决方案2】:

      你需要的不是IDEA的java Runtime版本,而是你使用的JDK到build 项目的更低版本。见Project SDK。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-06-26
        • 2022-10-04
        • 2022-11-12
        • 2022-08-08
        • 1970-01-01
        • 1970-01-01
        • 2023-03-28
        相关资源
        最近更新 更多