Try JBang

Below is a replit window which provides a Java development environment. Run hello.java by clicking the Run button. In the terminal you can use jbang hello.java or ./hello.java to run it directly.