Ah.. the old days of java programming - set up your CLASSPATH and done.. Nowadays; however, most libraries have tons on other dependencies and doing this manually is tedious and a pain in the neck - download the wrong version of the dependency, and you are in for a rabbit-hole trying to figure out the compilation errors.
Do not get me wrong, Maven is ugly and disgusting(so are the other dependency managers for java), but gone are the days of CLASSPATH.. unless you avoid using libraries bloated 3rd part libraries at any cost.
If you like to have most of the simplicity of just setting classpath, but still have convenient dependency resolution, I highly recommend checkig out coursier:
https://get-coursier.io/
Its a cli based artifact fetching tool for the JVM ecosystem, and you can have it just make up classpath strings for you, i.e., to use some Apache dependencies with the single file simplified java running you could just:
Also, maybe do have a look at scala-cli:
https://scala-cli.virtuslab.org/
It does work just fine with Java files, and allows you to write single-file programs that include dependencies as special comments. The tool has some idiosyncrasies (like a background compiler server), but overall works extremely well if you need some of the power of a build tool, but without having a complex project structure.