I don't have a direct answer.
But you could consider writing a batch file of a couple of lines, which:
- sets the JAVA_HOME as desired
- starts a build process
- sets the JAVA_HOME back to the original value
Would that be an easy workaround?
Yeah I am looking into that. I was hoping not to have to since the other things we build are really fragile. But that is starting to look like what I have to do. I noticed that the Android studio has an option to specify your jdk path and was hoping cli might have something similar. Thanks!
Use SETLOCAL and SET in your script. Like so:
cordova build ...
At the end of the script, JAVA_HOME will be restored to the previous value automatically.