From 1febd473686d8a8cc82f99f30bef0dba54fb1bf5 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 19 Apr 2017 08:19:46 -0700 Subject: [PATCH] Better JAVA_HOME detection. --- .../src/main/kotlin/com/beust/kobalt/SystemProperties.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/SystemProperties.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/SystemProperties.kt index b003aa9f..898f0594 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/SystemProperties.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/SystemProperties.kt @@ -2,8 +2,10 @@ package com.beust.kobalt class SystemProperties { companion object { - val javaBase = System.getProperty("java.home") ?: - (System.getenv("JAVA_HOME") ?: throw IllegalArgumentException("JAVA_HOME not defined")) + val javaBase = + System.getenv("JAVA_HOME") + ?: System.getProperty("java.home") + ?: throw IllegalArgumentException("JAVA_HOME not defined") val javaVersion = System.getProperty("java.version") val homeDir = System.getProperty("user.home") val tmpDir = System.getProperty("java.io.tmpdir")