How do I specify the java version to use with the Ammonite Scala shell on Windows?

284 views Asked by At

I am working on an enterprise system where I can't control my system Path environment variable, and the system path points to a version of Java that is currently broken. I have another version of Java installed, and I would like to use that to run the Ammonite shell. Is this possible?

1

There are 1 answers

0
Liam Bohl On

My hacky solution was to rename ammonite from amm.bat to amm-default.bat and create a new batch file called amm.bat that just adds my desired jre to the front of the session Path:

@echo off
set Path=C:\Users\bohlli\.jdks\corretto-1.8.0_292\bin;%Path%
amm_default.bat

I tried changing the path in the ammonite batch script itself, but every time I tried, something broke.