In a shell script I can set control the java version by setting the env variable JAVA_HOME near the top of the shell script to enforce that all subprocesses inherit that env var.
I’m trying to convert a bunch of shell scripts to a scala program. The program
creates a project in /tmp and launches sbt in that project. I’d like to control
which version of Java is used. Really I’d like to detect and die if java 14 is used.
What is the correct way do to this. Do I really need to intervene at every call to a subshell and introduce an env var at each point?
Isn’t there a way to set an env var for the UNIX process which Scala is running in?