Skip to content

Commit 72b1870

Browse files
committed
Fixed java executable for build/run in some environments
1 parent 2a9f2f4 commit 72b1870

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ tasks.register("createRunScript") {
177177
dependsOn("compileJava", "compileKotlin", "processResources")
178178

179179
doLast {
180-
// Get the Java executable from JAVA_HOME environment variable
181-
val javaHome = System.getenv("JAVA_HOME") ?: throw IllegalStateException("JAVA_HOME is not set")
182-
val javaExecutable = "$javaHome/bin/java"
180+
// Use the Java executable that Gradle is using
181+
val javaExecutable = "${System.getProperty("java.home")}/bin/java"
183182

184183
// Collect runtime classpath elements into a single string with path separator
185184
val runtimeClasspath = configurations["runtimeClasspath"].files.joinToString(File.pathSeparator) {

0 commit comments

Comments
 (0)