I am trying to run Scratch files in Android studio 3.4.1 and unable to see the output. I have created two files one with .kts extension and other with .java extension.
Below mentioned is the .kts file
class Check {
fun main(args: Array<String>) {
println(args[0]+"Hello, World!")
}
}
As per this question Kotlin scratch file output is missing in Android Studio we can run this file by writing print statement at top-level but still error remains the same. Below mentioned is the error:
"C:\Program Files\Android\Android Studio1\jre\bin\java.exe" "-javaagent:C:\Program Files\Android\Android Studio1\lib\idea_rt.jar=8940:C:\Program Files\Android\Android Studio1\bin" -Dfile.encoding=windows-1252 -classpath "C:\Program Files\Android\Android Studio1\plugins\Kotlin\kotlinc\lib\kotlin-compiler.jar;C:\Program Files\Android\Android Studio1\plugins\Kotlin\kotlinc\lib\kotlin-reflect.jar;C:\Program Files\Android\Android Studio1\plugins\Kotlin\kotlinc\lib\kotlin-stdlib.jar;C:\Program Files\Android\Android Studio1\plugins\Kotlin\kotlinc\lib\kotlin-script-runtime.jar" org.jetbrains.kotlin.cli.jvm.K2JVMCompiler -kotlin-home "C:\Program Files\Android\Android Studio1\plugins\Kotlin\kotlinc" -script C:/Users/ch-e01460.SPICEMONEY/.AndroidStudio3.4/config/scratches/scratch.kts
When i try to run this .Java file
class Scratch {
public static void main(String[] args) {
println("Hello, World!");
}
}
I get the below mentioned error
Error: Could not find or load main class Scratch Process finished with exit code 1
I have checked many other solutions available here but none of them is working for me. Requesting everyone here to enlighten the path so that it can help others too. Thanks in advance.