Skip to content

Commit 82dcb55

Browse files
committed
Set JDK home configuration key
This fixes the issue that `java.*` classes could not be resolved under Kotlin 1.8.20+.
1 parent 4c7ca41 commit 82dcb55

File tree

1 file changed

+5
-0
lines changed
  • server/src/main/kotlin/org/javacs/kt/compiler

1 file changed

+5
-0
lines changed

server/src/main/kotlin/org/javacs/kt/compiler/Compiler.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ private class CompilationEnvironment(
119119
// configure jvm runtime classpaths
120120
configureJdkClasspathRoots()
121121

122+
// Kotlin 1.8.20 requires us to specify the JDK home, otherwise java.* classes won't resolve
123+
// See https://github.com/JetBrains/kotlin-compiler-server/pull/626
124+
val jdkHome = File(System.getProperty("java.home"))
125+
put(JVMConfigurationKeys.JDK_HOME, jdkHome)
126+
122127
addJvmClasspathRoots(classPath.map { it.toFile() })
123128
addJavaSourceRoots(javaSourcePath.map { it.toFile() })
124129

0 commit comments

Comments
 (0)