Use JAVA_HOME when available

This commit is contained in:
Eugene Yokota 2024-12-15 14:59:02 -05:00
parent 0906b2d7ac
commit e854909592
1 changed files with 5 additions and 2 deletions

View File

@ -81,6 +81,9 @@ object Util:
}
lazy val javaHome: Path =
if sys.props("java.home").endsWith("jre") then Paths.get(sys.props("java.home")).getParent()
else Paths.get(sys.props("java.home"))
sys.env.get("JAVA_HOME") match
case Some(home) => Paths.get(home)
case None =>
if sys.props("java.home").endsWith("jre") then Paths.get(sys.props("java.home")).getParent()
else Paths.get(sys.props("java.home"))
end Util