As you said, in the case of a compile‑time error compilation fails and there is only whatever bytecode was in existence before the attempted compilation.
Exceptions cannot be thrown until the JVM starts.
Compilation is usually started with thee javac command and the JVM is usually started with the
java command.
You need to know the rules of syntax; anything breaching those rules will fail to compile.
You need to know the rules of the semantics of the language and when are breached, because that can cause an exception to be thrown.