using Kotlin with vscode on Mac --code works but intelisense shows [kotlin] Unresolved reference

Viewed 1105

I have installed the Kotlin Language extension into vscode on Mac. all works fine but intelisense show errors like[kotlin] Unresolved reference: println.

just tried with a simple .kt file :

fun main(args: Array<String>) {
println("hello ,world")

}

any idea what kind additional setting I should be doing ? thanks in advance.

2 Answers

i write kotlin in vsCode

1、 open u iTerm

brew install kotlin 

2、in vsCode Extensions search ' kotlin language ' insert and reload

3、and insert 'code runner'

over

From the github page for kotlin: https://github.com/jetbrains/kotlin

Build environment requirements
In order to build Kotlin distribution you need to have:

JDK 1.6, 1.7, 1.8 and 9

Setup environment variables as following:

  JAVA_HOME="path to JDK 1.8"
  JDK_16="path to JDK 1.6"
  JDK_17="path to JDK 1.7"
  JDK_18="path to JDK 1.8"
  JDK_9="path to JDK 9"

For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed and to point JDK_16 and JDK_17 environment variables to your JDK 1.8 installation.

I set JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-13.jdk" in my .*rc file and reloaded vscode. After that, the warning disappeared. Not sure if I need the others yet, but I seem to be fine with just JAVA_HOME set.

You can use find /Library -name java to find what versions are available.

Related