Peter Korsten wrote:What you need to do is throw an ExceptionInInitializerError.
Well, we don't quite
need to, in the sense that any other exception we throw will be caught by the JVM, wrapped in an ExceptionInInitializerError, and then rethrown. So if we want to throw some other (unchecked) exception with more specific information about what went wrong, that works too. There are pros and cons to each approach, but they both end up with the result that the class is subsequently unusable, and letting the JVM exit is often the best strategy.