Setting a distinct JAVA_HOME to Neo4j 5

Hi.

This is Linux env. Our app runs on Java 8 while Neo4j 5.x needs Java 17. Both are deployed on the same machine. Env variable JAVA_HOME is pointing to Java 8. We don't want to set it to Java 17 as other apps need it to be Java 8. I was wondering if there is any configuration that could advise Neo4j v5 to pick the Java 17 path instead of Java 8. I had a look at server.max_databases property, and tried to set the Java home path via it in neo4j.conf but that didn't work.
server.max_database=-Djava.home=/path/to/java17

I had a workaround to set JAVA_HOME in /bin/neo4j and that works. But I'm interested if there is a better way?

Thanks.