This also exists for Kotlin: https://github.com/Kotlin/kotlin-script-examples/blob/master... (note that the file extension is load bearing in this case, if you don't name it "*.main.kts", it will not work).

It's excellent for writing small scripts/prototyping where you need access to some Kotlin/JVM feature.

Ruby is still my preferred language for small scripts though - the backticks for running external programs is remarkably ergonomic

It's not going away entirely, but its future is also not so shiny:

https://blog.jetbrains.com/kotlin/2024/11/state-of-kotlin-sc...

I think it also exists for Java itself now.

Yes. You can just run java myfile.java