I'm currently having an issue with running java in my command prompt on Windows! I had to reinstall java and the eclipse IDE on my PC today as I was having issues running JavaFX in eclipse (now resolved yay) but I'm now having another problem previously I edited the environment path variables which worked with the previous install (I was using JDK13 at the time) but trying this again has been unsuccessful, I'm now using Java 8 as recommended by other students on my course to use an earlier version.
I'm able to use the command javac to compile the java files, however I receive the error message when trying to run with java Codes.java etc:
Error: Could not find or load main class Codes.java
I have tried this with some of the codes which ran perfectly fine before the reinstall (they are all quite basic, like string printing and some calculations so can't imagine there's a syntax issue with a different java version) but even the HelloWorld is producing the same error but will still compile? I am very confused :'(
Running Java programs the way you tried wasn't supported until recently so while Java 13 would have executed that command without any problems, Java 8 still required you to run the compiler, javac, first.