vscode-kotlin
vscode-kotlin copied to clipboard
What to specify for mainClass when there is none?
Motivation
It would be helpful if the tooltip showed what to do when there is no main class.
Description
I created a new directory, opened it, and created "main.kt"
fun main(args: Array<String>) {
println("hello?");
}
Then, I selected the default "kotlin" launch script, and it had "mainClass" setting. But my file has no main class. Tried "mainClass": "${workspaceFolder}\\main.kt"
, but it did not work.
Alternatives considered
Creating a class. But that's cumbersome.
The fully qualified name of your main class (usually your filename in PascalCase postfixed with Kt).
Could you try MainKt
?
Note that debugging support outside of Maven/Gradle projects is still pretty limited, you may have to manually compile with kotlinc
.
Same problem. I also tried MainKt, and compiled with kotlinc to a MainKt.class file.
[INFO] main Connected to client
[INFO] async1 Could not resolve kotlin-stdlib using Maven: Cannot invoke "java.nio.file.Path.getFileSystem()" because "path" is null
[INFO] async1 Successfully resolved kotlin-stdlib using Gradle
[INFO] async1 Starting JVM debug session with main class MainKt
Error: Could not find or load main class MainKt
Caused by: java.lang.ClassNotFoundException: MainKt
[INFO] eventBus Sent exit event
[INFO] async0 Exiting JDI session
This is also not a Gradle project, even though Gradle is installed on the system.
Same issue here! No matter what I try, compiling THEN launching still cannot find the main class