Skip to content

Java Exception Hierarchy

Exception handling allows problems detection within a Java application.

The main goals of exception handling are:

  1. separate business logic from error handling logic,
  2. log application issues in a clear way,
  3. recover of shutdown in a gracefull way.

JVM stands for Java Virtual Machine.

At the root there is Throwable, which branches into:

  • Exception: recoverable conditions,
  • Error: serious issues beyond program control.

Moreover, exceptions can be:

  1. checked: must be declared or caught (like IOException),
  2. unchecked: do not need explicit handling (like NullPointerException).

As of Java 21, Exception and Error subclassea are:

  • DirectoryThrowable
    • DirectoryException
      • AbsentInformationException line number or variable info not available
      • AgentInitializationException agent failed to initialize
      • AgentLoadException agent cannot be loaded into the target JVM
      • AlreadyBoundException try to bind an object to a name already associated
      • AttachNotSupportedException
      • AWTException
      • BackingStoreException
      • BadAttributeValueExpException
      • BadBinaryOpValueExpException
      • BadLocationException
      • BadStringOperationException
      • BrokenBarrierException
      • CardException
      • CertificateException
      • ClassNotLoadedException
      • CloneNotSupportedException
      • DataFormatException
      • DatatypeConfigurationException
      • DestroyFailedException
      • ExecutionControl.ExecutionControlException
      • ExecutionException
      • ExpandVetoException
      • FontFormatException
      • GeneralSecurityException
      • GSSException
      • IllegalClassFormatException
      • IllegalConnectorArgumentsException
      • IncompatibleThreadStateException
      • InterruptedException an occupied thread is interrupted
      • IntrospectionException
      • InvalidApplicationException
      • InvalidMidiDataException
      • InvalidPreferencesFormatException
      • InvalidTargetObjectTypeException
      • InvalidTypeException
      • InvocationException
      • IOException an I/O exception of some sort has occurred
      • JMException
      • JShellException
      • KeySelectorException
      • LambdaConversionException
      • LineUnavailableException
      • MarshalException
      • MidiUnavailableException
      • MimeTypeParseException
      • NamingException
      • NoninvertibleTransformException
      • NotBoundException
      • ParseException
      • ParserConfigurationException
      • PrinterException
      • PrintException
      • PrivilegedActionException
      • PropertyVetoException
      • ReflectiveOperationException
      • RefreshFailedException
      • RuntimeException can be thrown during JVM operation
      • SAXException
      • ScriptException
      • ServerNotActiveException
      • SQLException
      • StringConcatException
      • TimeoutException
      • TooManyListenersException
      • TransformerException
      • TransformException
      • UnmodifiableClassException
      • UnsupportedAudioFileException
      • UnsupportedCallbackException
      • UnsupportedFlavorException
      • UnsupportedLookAndFeelException
      • URIReferenceException
      • URISyntaxException
      • VMStartException
      • XAException
      • XMLParseException
      • XMLSignatureException
      • XMLStreamException
      • XPathException
    • DirectoryError
      • AnnotationFormatError
      • AssertionError
      • AWTError
      • CoderMalfunctionError
      • FactoryConfigurationError
      • FactoryConfigurationError
      • IOError
      • LinkageError
      • SchemaFactoryConfigurationError
      • ServiceConfigurationError
      • ThreadDeath
      • TransformerFactoryConfigurationError
      • DirectoryVirtualMachineError the JVM is broken
        • InternalError unexpected internal error
        • OutOfMemoryError JVM cannot allocate an object
        • StackOverflowError an app recurses too deeply
        • UnknownError unknown but serious exception

Some link for reference: