javac and javaeasy0-2 years

You see three different errors on three different days: `Greet.java:3: error: ';' expected`, `Error: Could not find or load main class Greet`, and a stack trace ending in `ArrayIndexOutOfBoundsException`. How do you tell what kind of problem each one is from the shape of the message alone, and why does the middle one confuse people the most?

Each message names the stage that produced it, and that stage tells you where to look. A line-and-file error (Greet.java:3: error) is a compile failure: the text you wrote isn't legal Java, nothing was built, and the fix is in the source. Could not find or load main class is a startup failure: the source compiled fine, but the JVM couldn't find the class you asked it to run — that's about where things are (the working directory, the classpath, exact spelling and case), not about your code's logic. A stack trace means it compiled, it loaded, and it ran — the values were wrong. The middle one confuses people specifically because the message names your class and the actual problem has nothing to do with what's inside it — it's a location problem wearing your class's name.

The lesson behind it →