Search code examples
javaspringspring-bootheroku

How can i use the --add-opens flag in heroku


i want to run the -- add-opens command in an application i distribute in every arrow, but i don't know where to add it in the cloud when i know where to add it in local

"Could not read JSON: Unable to make field private final int java.time.LocalDate.year accessible"

i was getting the error and

"https://stackoverflow.com/questions/70412805/what-does-this-error-mean-java-lang-reflect-inaccessibleobjectexception-unable"

i've come to a solution with this method, but now i want to deploy my project on every arrow, but i don't know how to report the add-open command to my application on the server, i tried to add it as a procfile and environment variable, but it didn't

(the application is crashed when i set the command to the environment variable)


Solution

  • Problem solved, I made a mistake in procfile's commands

    Before:

    java -Dspring.profiles.active=prod -Dserver.port=$PORT -jar target/*.jar --add-opens java.base/java.time=ALL-UNNAMED
    

    Then:

    java -Dspring.profiles.active=prod -Dserver.port=$PORT --add-opens java.base/java.time=ALL-UNNAMED -jar target/*.jar