I'm using Windows. So I download the Kotlin compiler from JetBrains/kotlin GitHub. It is a zip file (kotlin-compiler-2.2.21.zip). Then I extract the file and put it in the following path :
C:\Program Files
Next I set the Environment Variable :
C:\Program Files\kotlin-compiler-2.2.21\kotlinc\bin
When I test it in CMD :
kotlinc -version
I got the output :
info: kotlinc-jvm 2.2.21 (JRE 25.0.1+8-LTS-27)
Up to this point, everything working fine but when I run the following code (hello.kt) the error occur :
fun main() {
println("Hello, World!")
}
Error :
hello.kt:2:5: error: unresolved reference 'println'.
println("Hello, World!")
I run the code with this command :
kotlinc hello.kt -include-runtime -d hello.jar
Anyone know what is the problem ?
I already uninstall & re-install the zip file. But the result is same.