Class ExceptionInInitializerError


public class ExceptionInInitializerError extends LinkageError

Signals that an unexpected exception has occurred in a static initializer.

Present so an interpreted class initializer can fail the way Java says it fails: the first touch of a class whose <clinit> threw reports this, and every touch after it reports NoClassDefFoundError. Without the type, a pushed program's catch (ExceptionInInitializerError e) names a class the device does not have.

  • Constructor Details

    • ExceptionInInitializerError

      public ExceptionInInitializerError()
      Constructs an ExceptionInInitializerError with no detail message.
    • ExceptionInInitializerError

      public ExceptionInInitializerError(String s)
      Constructs an ExceptionInInitializerError with the specified detail message. s - the detail message.
    • ExceptionInInitializerError

      public ExceptionInInitializerError(Throwable thrown)
      Constructs an ExceptionInInitializerError for the given throwable. thrown - the exception the initializer threw.
  • Method Details

    • getException

      public Throwable getException()
      The exception the class initializer threw, or null.
    • getCause

      public Throwable getCause()
      Same as getException(), for code written against the Throwable API.
      Overrides:
      getCause in class Throwable