Could not find or load main class org.javacs.kt.MainKt
See original GitHub issueHi there,
Pardon my ignorance as I am completely new to the Java/Kotlin ecosystem and so understand very little about all the tools. I tried to search for similar issues but was unable to find anything which matched the exact problem I’m having. I will try to explain as much about my setup as possible so that it makes it easier for you to help me 😃
When I open a kotlin file in nvim using coc, I am unable to start KLS due to the following error:
[Error - 5:51:04 PM] ~/Programs/kotlin-language-server/server/build/scripts/kotlin-language-server exited with code: 1
Error: Could not find or load main class org.javacs.kt.MainKt
Caused by: java.lang.ClassNotFoundException: org.javacs.kt.MainKt
[Error - 5:51:04 PM] Connection to server got closed. Server will not be restarted.
[Error - 5:51:04 PM] ~/Programs/kotlin-language-server/server/build/scripts/kotlin-language-server exited with code: 1
I set up a project by using https://start.spring.io/ and selecting Kotlin, Java 11, Gradle and Spring Boot 2.2.6 with the Web dependency.
I have also installed the Kotlin compiler separately and added it’s bin/
folder to my path so kotlinc
is available.
I’m able to build the project using ./gradlew build
and also run it successfully using ./gradlew bootRun
.
If I run java -version
on my machine I get the following output:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
Appreciate any help I can get as I would be really happy to continue using vim instead of switching to IntelliJ for a new Kotlin project that I will be a part of!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Thanks for the pointer, I should be able to find a way to configure that in my editor.
Please close this issue and thanks for your help it’s much appreciated!
I’m not sure how coc works, but you should be able to provide a config of some sort to your LSP provider. Here’s a solution from another issue:
https://github.com/fwcd/kotlin-language-server/issues/72#issuecomment-512899441