formulahendry / vscode-code-runner

Code Runner for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
MIT License
2.21k stars 298 forks source link

Error Running kotlin #493

Open Art1964 opened 5 years ago

Art1964 commented 5 years ago

Describe the bug When executing the program kotlin the output screen shows the following message: "there is no main manifest attribute in test.jar"

To Reproduce Steps to reproduce the behavior:

  1. run hello world example

Actual behavior Description of what happened actually.

Expected behavior Description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Walker-ZHAO commented 5 years ago

I meet the same issue! VS Code Version: 1.3.51 OS Version: macOS 10.14.5 Code Runner Version: 0.9.11

formulahendry commented 5 years ago

Could you please share the screenshots?

huqifan commented 5 years ago

I think it's a kotlinc issue. Please use this command instead. kotlinc hello.kt -include-runtime -d hello.jar && kotlin -classpath hello.jar HelloKt

Walker-ZHAO commented 5 years ago

I think it's a kotlinc issue. Please use this command instead. kotlinc hello.kt -include-runtime -d hello.jar && kotlin -classpath hello.jar HelloKt

Yes, this command works properly, but due to it's not dynamic, I can't put it into my settings.json file, I can use $fileName and $fileNameWithoutExt, but can't confirm the class name. The version of kotlinc is 1.3.40, look like it's a kotlinc issue, thx.

fatfatson commented 5 years ago

@file:JvmName("HelloKt")

use this to set class name

whataa commented 5 years ago

@file:JvmName("HelloKt")

use this to set class name

Once successfully run once, it can run without any other settings. I don't know why.

hassanahtasham commented 3 years ago

I have the same problem, but above sol is not working