No SDK in IntelliJ Idea for Kotlin Development? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

No SDK in IntelliJ Idea for Kotlin Development?

https://www.sololearn.com/post/1178916/?ref=app https://www.sololearn.com/post/1180105/?ref=app I use IntelliJ Idea. JDK 16 is installed in my laptop. I can run Java codes but I cannot run Kotlin's code. What should I do?

9th Jul 2021, 10:35 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
8 Answers
+ 3
Do this to test of your install works. First make sure that the Kotlin plug-in is installed and up to date. Start IntelliJ - close any open projects so that you are at the welcome to IntelliJ IDEA window. At the bottom left click the gear icon and check for updates. Update IntelliJ and plug-ins until no further updates are available. Now select Plugins from the left pane of the welcome window and go to 'installed' and make sure that Kotlin is installed (it should be as it is installed by default). Once you have verified it is installed, or you have installed it, select Projects in the left pane. Then click the 'New Project' button. In the left pane select Kotlin. In the right pane give the Name: as 'Test'. Change the Project Template to 'Console Application'. Make sure the build system is set to 'Gradle Kotlin'. Then select your current install of your JDK under Project JDK. Click the 'Next' button. Here make sure that the Target JVM version is 1.8 for now and click the 'Finish' button. ... continued ...
10th Jul 2021, 4:13 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
Kotlin is built on top of Java. Select the JDK16 that you have installed.
9th Jul 2021, 11:09 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Let the project load completely, waiting until the progress bar at the bottom is finished and gone. Gradle may need to download some updates so make sure you have a good internet connection. Once done select the Project tab and navigate to the main.kt. src->main->kotlin->main.kt and click it to bring up the code in the editor. You should see a hello world in the main function. Now build the project (click the hammer in the toolbar or build->build project). Wait for it to finish building (progress bar at the bottom should be done and gone.) Now next to the main function there should be a green arrow. Click it and select Run 'MainKt'. The console should open and you should see your hello world output. If this is true then you're up and running. Just repeat the steps for the project settings you want.
10th Jul 2021, 4:21 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
Hmm, I haven't tried JDK 16 with it yet, but I can tell you that JDK 14 does work. At least it worked for me when I tested it earlier today.
10th Jul 2021, 6:29 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
ChaoticDawg I selected it but I cannot build Kotlin projects.
10th Jul 2021, 2:59 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 2
10th Jul 2021, 6:22 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 2
Muhd Khairul Amirin You're welcome. Hopefully you got it working.
10th Jul 2021, 6:23 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg Yeah. I use JDK11 to get it working instead of JDK16
10th Jul 2021, 6:24 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar