package com.beust.kobalt

class SystemProperties {
    companion object {
        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")
        val currentDir = System.getProperty("user.dir")
        val username = System.getProperty("user.name")
    }
}


package com.beust.kobalt

class SystemProperties {
    companion object {
        val javaBase : String
            get() {
                val jh = System.getenv("JAVA_HOME")
                    ?: System.getProperty("java.home")
                    ?: throw IllegalArgumentException("JAVA_HOME not defined")
                val result =
                    if (jh.toLowerCase().endsWith("jre")) jh.substring(0, jh.length - 4)
                    else jh
                return result
            }
        val javaVersion = System.getProperty("java.version")
        val homeDir = System.getProperty("user.home")
        val tmpDir = System.getProperty("java.io.tmpdir")
        val currentDir = System.getProperty("user.dir")
        val username = System.getProperty("user.name")
    }
}


Make sure JAVA_HOME points to the JDK and not the JRE.
Make sure JAVA_HOME points to the JDK and not the JRE.

Should fix https://github.com/cbeust/kobalt/issues/428.

cbeust/kobalt,ethauvin/kobalt,ethauvin/kobalt,cbeust/kobalt,ethauvin/kobalt,ethauvin/kobalt,cbeust/kobalt