Last updated on May 20th, 2018 at 03:05 pm
I have recently decided to start learning Kotlin, instead of improving my Java. So here are some of the initial issues I encountered as a beginner in Kotlin and the Kotlin Setup. I hope it helps you alleviate some of the same issues in ItelliJ or Eclipse, if you encounter them.
Installing JDK on windows.
Possible error : Another Java instance is installing.
Solution : Navigate to C:\Users\yourUsername\AppData\LocalLow\Oracle , and delete the java folder in there. Try reinstalling and jdk will install .
Add jdk path to windows
Go to, This Pc >> then system Properties , located at the top >> Then go to Advanced System Settings >> Then click on Environment Variables.
Then , Under System Variables, scroll until you see path . Double click on it.
Then under Variable value, scroll to the end . Then add a semi-colon if there isn’t one already. Then add your JDK bin folder after it and click ok.
Your JDK bin folder can be found in a path similar to this : C:\Program Files\Java\jdk-10.0.1\bin .
Find it and add it. Click Ok. Then click Ok again.
Confirmation of JDK Path success in Windows
Open up Windows Command prompt. Or restart it if it was already open. Type javac and hit enter.
If it shows you a bunch of help commands, then the path has been successfully registered.
If it shows you the following message then, you need to find out where you messed up.
‘javac’ is not recognized as an internal or external command, operable program or batch file.
You can also confirm successful path by checking the JDK version using :
After installing IntelliJ Idea or Eclicpse ..
Then you try to run a program and get the following error:
Error:Cannot run program “C:\Program Files\Java\jdk1.8.0_71\bin\java.exe” (in directory “C:\Users\yourUsername\.IdeaIC2018.1\system\compile-server”): CreateProcess error=2, The system cannot find the file specified
If you encounter the … Error:Cannot run program “C:\Program Files\Java\jdk1.8.0_71\bin\java.exe” (in directory “C:\Users\…\.IdeaIC2018.1\system\compile-server”): CreateProcess error=2, The system cannot find the file specified error ,
first of all ensure you have installed jdk and has added the path to windows Variables as explained above.
Then ensure you have added the path to your JDK on the Project SDK selector. For this, if your project is already created in IntelliJ Idea, go to File >> project Structure . Or just press CTRL SHIFT ALT S .
Then under SDKs , select your JDK Home Path . Browse to the folder where your JDK is installed , for me it is C:\Program Files\Java\jdk-10.0.1\ . Select yours and click OK.
This should help you run your Java and Kotlin programs successfully when you are just getting started.