Skip to content

Commit

Permalink
Set JDK home configuration key
Browse files Browse the repository at this point in the history
This fixes the issue that `java.*` classes could not be resolved under
Kotlin 1.8.20+.
  • Loading branch information
fwcd committed Oct 3, 2023
1 parent 4c7ca41 commit 82dcb55
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/main/kotlin/org/javacs/kt/compiler/Compiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ private class CompilationEnvironment(
// configure jvm runtime classpaths
configureJdkClasspathRoots()

// Kotlin 1.8.20 requires us to specify the JDK home, otherwise java.* classes won't resolve
// See https://github.com/JetBrains/kotlin-compiler-server/pull/626
val jdkHome = File(System.getProperty("java.home"))
put(JVMConfigurationKeys.JDK_HOME, jdkHome)

addJvmClasspathRoots(classPath.map { it.toFile() })
addJavaSourceRoots(javaSourcePath.map { it.toFile() })

Expand Down

0 comments on commit 82dcb55

Please sign in to comment.