To start with - Yes, I know that this is crazy/strange. But I need it :).
I want to find simpliest way to run single java file (and prefer non-termi
This may be too late but this might help other developers,
If you're using JAVA, you need to write it as told by @Andrey.
If you're using Kotlin, you can simply write a function without making a Class.
fun main(){
println("you")
}
This will work.
But, remember, function name should only be main and don't use anything that is part of Android JDK inside this main function.
Ex:- if you write
fun main(){
Log.e("you","you")
}
Now as Log is part of Android, you'll get runtime exception saying
Exception in thread "main" java.lang.RuntimeException: Stub!