Why does this work in executing my code:
java -cp . Main
but not this:
java Main
I have always used just java <classname> for executing my code, however almost randomly, this command just provides the error message Error: Could not find or load main class Main.
Here's my Java file (Main.java):
public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
Here's the output from my Command Prompt including file names