how to run java \program from command line macos code example
Example: How do I compile and run a program in Java on my Mac?
cd ~
javac HelloWorld.java
//for running it
java HelloWorld
cd ~
javac HelloWorld.java
//for running it
java HelloWorld