I am trying to get familiar with Kotlin to use in my android apps. So first I want to try out some simple kotlin examples, just to get familiar with syntax of kotlin.
I made a class named Main.kt
in my android project with just main method.
fun main(args: Array<String>) {
println("Hello World"); }
Android studio shows me a kotlin icon to left of main method and when I click on this icon, It shows me below three option:
1) Run Mainkt
2) Debug Mainkt
3) Run Mainkt with coverage
I chose first one but it throws me
Exception in thread "main" java.lang.ClassNotFoundException: com.vikalp.kotlin.MainKt
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:107)
I am stuck with such a small problem. Let me know if anyone of you have faced problem like this and what is the solution.