I’m trying to run a scratch file to no avail. When I run even a simple function:
println("Hello World")
I get this exception:
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
at org.jetbrains.kotlin.idea.scratch.generated.ScratchFileRunnerGenerated.main(tmp.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Hello, I can’t reproduce this on Kotlin 1.2.60, IDEA 2018.2. Can you share the output of the “run” tool window when you invoke “Main menu → Run → Run ‘scratch.kts’”. For example:
/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/java “-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=56071:/Applications/IntelliJ IDEA CE.app/Contents/bin” -Dfile.encoding=UTF-8 -classpath /Users/belkov/Idea/2018.2-CE/plugins/Kotlin/kotlinc/lib/kotlin-compiler.jar:/Users/belkov/Idea/2018.2-CE/plugins/Kotlin/kotlinc/lib/kotlin-reflect.jar:/Users/belkov/Idea/2018.2-CE/plugins/Kotlin/kotlinc/lib/kotlin-stdlib.jar:/Users/belkov/Idea/2018.2-CE/plugins/Kotlin/kotlinc/lib/kotlin-script-runtime.jar org.jetbrains.kotlin.cli.jvm.K2JVMCompiler -kotlin-home /Users/belkov/Idea/2018.2-CE/plugins/Kotlin/kotlinc -script /Users/belkov/Idea/2018.2-CE/config/scratches/scratch.kts
Hello World
I’m experiencing the same issue (works from the main menu but not from the scratch run button) and don’t have any of those problems. Using the last version of community edition and not using any custom classes (the content of the scratch file is exactly this: println("hello world!")).