简体   繁体   中英

I can't find a working way to change the Heroku OpenJDK to 11 instead of 8

as you can see in the title, I'm trying to deploy an app to Heroku. But when I try to push to main branch, Heroku builds the app with OpenJDK 8. As I'm using Gradle 7.5.1, I need at least Java 11 to run. So I'm trying to make Heroku build my app with OpenJDK 11. As shown in below picture, the prompt shows different ways to achieve that (or at least I think so). Build failure

I've tried to change my IDE settings -> Nothing changed I've changed my JAVA_HOME environment variable (plus the ref in PATH) -> Nothing changed I added a org.gradle.java.home property in gradle.properties pointing to my jdk11 path -> Nothing changed

I added a system.properties file at the root with

java.runtime.version=11 //also tried 11.0.17

in it -> Nothing changed

I have searched for answers on the Inte.net, but every "solution" that I found were not making Heroku use OpenJDK 11 so they didn't work for me.

I'm currently out of idea, and I would like to use a proper way to do it. If any of you have encountered this problem and met a solution, I would be pleased to hear it.

Also, I am aware that I have to push changes to main branch if I develop on another branch (I saw that problem for another person, but it's not that for me).

Thank you for your time

In system.properties try explicit set distibution:

 java.runtime.version=zulu-11

Because your stack: heroku-22 and Azul-zulu distribution set by default.

Explanation of that you can find here:

https://devcenter.heroku.com/articles/java-support#specifying-an-openjdk-distribution

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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