You aren't supposed to rely on a bug.
It's not a bug.
The JLS 3rd ed., which covers Java 5 and Java 6, says,
"A Java virtual machine starts up by loading a specified class and then
invoking the method main in this specified class."
Exactly. It loads the specified class, as part of which that class's
static initializer runs. And if it's an enum, the enum elements'
initializers run too.
If one of those calls System.exit(0) you could argue, theoretically,
that there's an ambiguity in what the spec says should be the behavior.
On the one hand, System.exit(0) should terminate the running VM instance
when invoked. On the other hand, that precludes "and then invoking the
method main in this specified class".
However, the observed behavior seems to be out of spec. The main
method's absence should prompt an error upon the attempt to invoke it,
and did. The error being generated before the main method should be
being invoked is dissimilar from any other JVM behavior. For example, if
you create code that attempts to invoke Foo.quux() by reflection, and
there's no quux static method in class Foo, there won't be any error
until the reflection attempt, which will throw an exception when it occurs.
More generally, "and then invoking the method main" can mean one of two
things, given that main itself is static: the call to main is statically
compiled in, in which case javac should complain when compiling the call
site, or the call to main is reflective, in which case the error should
not occur until runtime and should not occur until the running code
reaches the location of the reflective invocation. We're now seeing an
error later than compile time and earlier than the running code reaches
the location of the reflective invocation, which behavior is
inconsistent with *each* static-method call semantic.