Skip to content

Commit

Permalink
bugfix: Don't try to always get system jvm first
Browse files Browse the repository at this point in the history
Previously, we would always first specify `system|` when downloading default JVM, which would coursier just return java from JAVA_HOME without any checks even if we needed to download never Java. Now, we only use specific versions, since java home is handled before.
  • Loading branch information
tgodzik committed Nov 2, 2023
1 parent eced0b3 commit bded8a0
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,7 @@ object OsLibc {
}

def defaultJvm(os: String): String = {
val hasEmptyJavaHome = Option(System.getenv("JAVA_HOME")).exists(_.trim.isEmpty)
val defaultJvm0 = baseDefaultJvm(os, defaultJvmVersion)
if (hasEmptyJavaHome)
// Not using the system JVM if JAVA_HOME is set to an empty string
// (workaround for https://github.com/coursier/coursier/issues/2292)
defaultJvm0
else
s"${JavaHome.systemId}|$defaultJvm0"
baseDefaultJvm(os, defaultJvmVersion)
}

def javaVersion(javaCmd: String): Int = {
Expand Down

0 comments on commit bded8a0

Please sign in to comment.