diff --git a/kex-core/src/main/kotlin/org/vorpal/research/kex/util/rt.kt b/kex-core/src/main/kotlin/org/vorpal/research/kex/util/rt.kt index 2c9e936aa..53118f429 100644 --- a/kex-core/src/main/kotlin/org/vorpal/research/kex/util/rt.kt +++ b/kex-core/src/main/kotlin/org/vorpal/research/kex/util/rt.kt @@ -11,6 +11,7 @@ import org.vorpal.research.kthelper.assert.unreachable import org.vorpal.research.kthelper.logging.log import java.io.File import java.nio.file.Path +import java.nio.file.Paths import kotlin.io.path.readLines val Config.outputDirectory: Path get() = getPathValue("kex", "outputDir")!!.normalize() @@ -50,6 +51,12 @@ val Config.libPath: Path? runtimeDepsPath?.resolve(it)?.normalize() } +fun getJDKPath(): Path { + return Paths.get(System.getProperty("java.home")).parent.toAbsolutePath() +} + +fun getJavaPath(): Path = getJDKPath().resolve("bin", "java").toAbsolutePath() + fun getRuntime(): Container? { if (!kexConfig.getBooleanValue("kex", "useJavaRuntime", true)) return null val libPath = kexConfig.libPath ?: return null diff --git a/kex-executor/src/main/kotlin/org/vorpal/research/kex/worker/ExecutorMaster.kt b/kex-executor/src/main/kotlin/org/vorpal/research/kex/worker/ExecutorMaster.kt index 893a1e281..821103fe6 100644 --- a/kex-executor/src/main/kotlin/org/vorpal/research/kex/worker/ExecutorMaster.kt +++ b/kex-executor/src/main/kotlin/org/vorpal/research/kex/worker/ExecutorMaster.kt @@ -14,6 +14,7 @@ import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionTimedOutResult import org.vorpal.research.kex.trace.symbolic.protocol.Master2ClientConnection import org.vorpal.research.kex.trace.symbolic.protocol.Master2WorkerConnection import org.vorpal.research.kex.trace.symbolic.protocol.MasterProtocolHandler +import org.vorpal.research.kex.util.getJavaPath import org.vorpal.research.kex.util.getJvmModuleParams import org.vorpal.research.kex.util.getPathSeparator import org.vorpal.research.kex.util.newFixedThreadPoolContextWithMDC @@ -84,7 +85,7 @@ class ExecutorMaster( private fun createProcess(): Process { val pb = ProcessBuilder( - "java", + getJavaPath().toString(), *workerJvmParams, "-Djava.security.manager", "-Djava.security.policy==${executorPolicyPath}", diff --git a/kex-runner/src/main/kotlin/org/vorpal/research/kex/trace/runner/SymbolicExternalTracingRunner.kt b/kex-runner/src/main/kotlin/org/vorpal/research/kex/trace/runner/SymbolicExternalTracingRunner.kt index 48f253d6f..1cdbaf2b9 100644 --- a/kex-runner/src/main/kotlin/org/vorpal/research/kex/trace/runner/SymbolicExternalTracingRunner.kt +++ b/kex-runner/src/main/kotlin/org/vorpal/research/kex/trace/runner/SymbolicExternalTracingRunner.kt @@ -12,6 +12,7 @@ import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionCompletedResult import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionResult import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionTimedOutResult import org.vorpal.research.kex.trace.symbolic.protocol.TestExecutionRequest +import org.vorpal.research.kex.util.getJavaPath import org.vorpal.research.kex.util.getJvmModuleParams import org.vorpal.research.kex.util.getPathSeparator import org.vorpal.research.kex.util.outputDirectory @@ -56,7 +57,7 @@ internal object ExecutorMasterController : AutoCloseable { val kfgClassPath = ctx.classPath val pb = ProcessBuilder( - "java", + getJavaPath().toString(), "-Djava.security.manager", "-Djava.security.policy==${executorPolicyPath}", "-Dlogback.statusListenerClass=ch.qos.logback.core.status.NopStatusListener", *getJvmModuleParams().toTypedArray(),