fwcd/kotlin-language-server

VSCode Extension on MacOSX - Not working with JDK 10

rmaclean opened this issue · 2 comments

After resolving my previous issue the next error message I got was The Kotlin Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

This was resolved by changing JAVA_HOME to point to JDK 8 and not 10.

If anyone does hit this, it seems you can also change the VSCode config value java.home to point to the JDK version to use.

Logging here for 2 reasons:

  1. if someone else has this issue maybe they can find this to resolve their issues
  2. happy to try and help out with maybe declaring dependencies or something to make this more robust? not really sure where that would be - a rough pointer and I will gladly dig into it.

I worked this out by trying to run the language server manually and got this at the command prompt.

Exception in thread "main" java.lang.IllegalStateException: LOGGING: Loading modules: [java.se, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web, jdk.accessibility, jdk.attach, jdk.compiler, jdk.dynalink, jdk.httpserver, jdk.incubator.httpclient, jdk.jartool, jdk.javadoc, jdk.jconsole, jdk.jdi, jdk.jfr, jdk.jshell, jdk.jsobject, jdk.management, jdk.management.cmm, jdk.management.jfr, jdk.management.resource, jdk.net, jdk.packager, jdk.packager.services, jdk.scripting.nashorn, jdk.sctp, jdk.security.auth, jdk.security.jgss, jdk.unsupported, jdk.xml.dom, oracle.desktop, oracle.net, java.base, java.compiler, java.datatransfer, java.desktop, java.xml, java.instrument, java.logging, java.management, java.management.rmi, java.rmi, java.naming, java.prefs, java.scripting, java.security.jgss, java.security.sasl, java.sql, java.sql.rowset, java.xml.crypto, jdk.internal.jvmstat, jdk.management.agent, jdk.jdwp.agent, jdk.internal.ed, jdk.internal.le, jdk.internal.opt, jdk.jlink] (no MessageCollector configured)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report(ClasspathRootsResolver.kt:314)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.report$default(ClasspathRootsResolver.kt:312)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.addModularRoots(ClasspathRootsResolver.kt:254)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:124)
	at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:233)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:117)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
	at org.javacs.kt.Compiler.<init>(Compiler.kt:52)
	at org.javacs.kt.CompilerClassPath.<init>(CompilerClassPath.kt:9)
	at org.javacs.kt.KotlinLanguageServer.<init>(KotlinLanguageServer.kt:14)
	at org.javacs.kt.MainKt.main(Main.kt:8)
fwcd commented

@rmaclean The currently used Kotlin compiler probably does not support JDK 10. Switching to a newer Kotlin version in build.gradle might solve this problem.

fwcd commented

Java 11 support is coming in #109.