The JVM went looking for the class you named and its main method, and couldn’t find the class at all. This is the first error every Java student meets, and it’s nearly always about names and places: the class name doesn’t match the file, you’re in the wrong folder, the class is in a package you didn’t account for — or there’s no compiled .class file because javac never ran (or failed).
javac Main.java must complete without errors and produce Main.class in the same folder. Running java Main on a file that never compiled is the #1 cause.java Main — not java Main.java and not java Main.class.main and Main are different classes to the JVM.java com.example.Main, executed from the directory that contains the com folder.java -cp . Main includes the current folder. A classpath that omits . loses local classes.In an IDE, this error at launch usually means the run configuration points at the wrong main class, or the project didn’t build — check the build output before the code. And confirm the class truly has a main method with that exact signature (public static void main(String[] args)) — a near-miss (missing static) loads the class but rejects the method with a different message.
Why did it work yesterday in the same folder? Usually the .class file was deleted, or the code was edited and recompiled with an error that scrolled past. Recompile and actually read javac’s output.
What’s the difference between this and ClassNotFoundException? Same family: the launcher prints “Could not find or load main class” as the headline, with ClassNotFoundException as the cause underneath. The checks are identical.