hello everyone,
I’m trying to run a kotlin class from CLI(Kotlin command-line compiler | Kotlin Documentation), but I get some errors:
Can anyone help me to find out the problem??
Thanks to all,
hello everyone,
I’m trying to run a kotlin class from CLI(Kotlin command-line compiler | Kotlin Documentation), but I get some errors:
Can anyone help me to find out the problem??
Thanks to all,
Can you include the code you’re trying to compile?
Though tbh, this looks like a bug with the compiler. I’ve just briefly skimmed the docs, but using the -include-runtime flag should include Kotlin runtime library (which I assume is the same as the standard library?) so you should be able to use code from the standard library like println.
How did you install the compiler? Maybe it’s missing the runtime library, or something?
The code of my app is really simple @Skater901:
fun main() {
println("Hello, World!")
}
I download compiler from GitHub, I didn´t install it (I don’t know how to install it) Is it needed to install it??
Nope, looks like you did the steps correctly: https://kotlinlang.org/docs/command-line.html#manual-install
Tbh I’ve never used the command line compiler. Is there a reason you’re using it instead of IntelliJ? I don’t think I can help, unfortunately. ![]()
Thanks for you reply @Skater901.
There’s no any special reason for using command line compiler. Simply, in my old PC I don´t have enough RAM to install IntelliJ………… the message error is very confusing for me, definitively, I don’t understand the problem ![]()
I don’t understand either, but my rough guess is that it can’t find the Kotlin standard library (which is where println() et al are defined). So I’d poke around and try to confirm that it came with the compiler and is where the compiler is likely to find it.
(The -include-runtime flag is related but slightly different, as that will include the standard library in the output jar. But even if it’s not doing that, the compiler will need access to it while compiling, in order to identify the correct classes and methods.)