Hi. Im new to JAVA and Im currently reading the book Head First Java. I have installed java 8 in my Mac (macOS Sierra 10.12). I tried the HelloWorld example but it says "file not found." I used textedit and saved it as "HelloWorld.java" on my desktop under test folder.
Navigate to where the class file is located
Now run java HelloWorld
Note: You should NOT give the .class extension to this command.
The problem is the JVM does not know where your class files are. So you navigate to the directory where they are located (cd ~/Desktop/test) and then execute them.
To simplify this process you can set the class path (path at which the JVM can expect to find class files)
More on it here