mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-05-02 02:38:12 -07:00
30 lines
1 KiB
Kotlin
30 lines
1 KiB
Kotlin
package com.beust.kobalt
|
|
|
|
import java.io.File
|
|
|
|
abstract public class JavaInfo {
|
|
public var javaExecutable: File? = null
|
|
get() = findExecutable("java")
|
|
public var javacExecutable: File? = null
|
|
get() = findExecutable("javac")
|
|
public var javadocExecutable: File? = null
|
|
get() = findExecutable("javadoc")
|
|
abstract public var javaHome: File?
|
|
abstract public var runtimeJar: File?
|
|
abstract public var toolsJar: File?
|
|
|
|
abstract public fun findExecutable(command: String) : File
|
|
|
|
companion object {
|
|
fun create(javaBase: File?): Jvm {
|
|
val vendor = System.getProperty("java.vm.vendor")
|
|
if (vendor.toLowerCase().startsWith("apple inc.")) {
|
|
return AppleJvm(OperatingSystem.Companion.current(), javaBase!!)
|
|
}
|
|
if (vendor.toLowerCase().startsWith("ibm corporation")) {
|
|
return IbmJvm(OperatingSystem.Companion.current(), javaBase!!)
|
|
}
|
|
return Jvm(OperatingSystem.Companion.current(), javaBase)
|
|
}
|
|
}
|
|
}
|