kotlin-language-server
kotlin-language-server copied to clipboard
No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE)
Describe the bug
All lines in build.gradle.kts
have this error:
No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE)
Extension version 0.2.11
Additional context
gradle 0.6.1
kotlin jvm plugin 1.3.61
Used through Remote SSH on a remote Linux server
gradle run
from the command line on the server runs the app fine
Let me know what additional info I should provide to help troubleshooting.
Just noticed that this was reported before as https://github.com/fwcd/kotlin-language-server/issues/159 - I guess the exception was not in textual form, but a screenshot instead, so I could not find it.
I'm not sure if these are duplicates since the current title of the #159 is "Ensure that Kotlin Script Runtime is on classpath in non-Gradle/Kotlin DSL projects", but if it is or if you want to track in one or another, might be good to either merge or close one or the other.
So how does one solve this problem?
+1
+1
Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.
Somehow, after I installed this extension, everything works fine on my VSCode.
I had this same issue in build.gradle.kts file, i am using coc.nvim
@LorenzooG, same here
This must be a bug since kotlin-language-server:83
sets the classpath to
CLASSPATH=...:$APP_HOME/lib/kotlin-script-runtime-1.3.50.jar:...
($APP_HOME
confirmed to be correct)
kotlin-script-runtime-1.3.50.jar
contains the necessary class file.
Test.kts:
HelloWorldKotlin.iml file have a senctance about "<orderEntry type="sourceFolder" forTests="false" />";just turn on forText is OK;
Anybody found solution?
Where we can start looking for contributing? Would be nice to have .kts
file support.
+1
Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.
Somehow, after I installed this extension, everything works fine on my VSCode.
For me it does not solve the problem, the extension just stops working (And thus no errors are shown). Maybe it has more priority one extension than another?
This error vanished for me when I restarted vscode.
I can confirm the same happening as well after installing the extension for gradle.kts files. All Kotlin (.kt) files get detected correctly however. Restarting VSCode did not solve the issue.
Same issue here, present after restarting.
+1
I'm having this same issue.
This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.
In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.
Once I fixed pom.xml it became visible in the Maven window:

I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.
This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.
In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.
Once I fixed pom.xml it became visible in the Maven window:
![]()
I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.
I'm transitioning from using groovy Gradle scripts to Kotlin and installed this extensions and had the issue listed in this ticket. Going to Command Palette and executing Kotlin: Restart the Language Server resolved the issue for me as well. Also running VS Code with the Remote SSH extension.
VS Code: 1.73.1 Gradle: 7.5.1 Kotlin Extensions: v0.2.26
A couple things:
- When using Gradle for Java extension in VS Code, the classpath for gradle and the language server extensions can out of sync. Often I have to restart the Java Language Server (Alt+Shift+U) and seems to be the case for restarted the Kotlin Language server as well.