This error occurs because you have not installed the Java JDK
.
How to use Kotlin in VS code
First you need to install the following programs on your machine
- Install Java JDK on the computer system
- Install Kotlin on your computer system
- VS code install plugin Kotlin Language
- VS code install plugin Code Runner
installation steps:
-
Please install Java JDK according to this document
After the installation is complete, you can run the
java -version
command in the cmd window to check whether the installation is successful -
Download the kotlin compiler here
After unzipping, add the bin folder path to the system environment variables
After the installation is complete, you can run the
kotlinc -version
command in the cmd window to check whether the installation is successful -
Install plugins in VS code: Kotlin Language and Code Runner
It is now possible to use Kotlin in VS code.
Use the play button in the upper right corner or right-click to select Run Code to run the code
If you want the result to be output in the TERMINAL panel, please add the following configuration in settings.json
"code-runner.runInTerminal": true,
0
solved “Java is not recognised as an internal or external command” in vs code even though I am trying to use kotlin. I properly set the path also