簡體   English   中英

在 Intellij Idea 中更改 Java 運行時版本

[英]Change Java Runtime Version in Intellij Idea

我正在將使用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運行時版本

You need to change the Java version on Heroku where you deploy the application (by default Heroku provides Java 8, as you correctly verified).

在項目根目錄中放置一個文件system.properties ,其中包含:

java.runtime.version=11

您需要更改的不是 IDEA 的 java Runtime 版本,而是您用於構建項目的JDK到較低版本。 請參閱項目 SDK

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM