Java SE 21 — Standard Exceptions & Errors
Generated: 2025-10-11 10:42 UTC
1. [Link] (Core exceptions & errors)
Throwable - The superclass of all errors and exceptions. Error (unchecked; usually not caught) - AssertionError: thrown
when an assertion fails. - LinkageError: problems linking classes (NoClassDefFoundError, ClassFormatError,
UnsupportedClassVersionError). - VirtualMachineError: JVM-level failures (OutOfMemoryError, StackOverflowError,
InternalError). - ExceptionInInitializerError: failure during static initialization. Exception - RuntimeException (unchecked;
programmer errors) - ArithmeticException: numeric error (e.g., divide by zero). - ArrayStoreException: storing wrong
type into array. - ClassCastException: invalid cast. - ConcurrentModificationException: concurrent modification of
collection. - IllegalArgumentException: method received illegal argument. - NumberFormatException: invalid
string-to-number conversion. - IllegalStateException: method invoked at illegal or inappropriate time. -
IndexOutOfBoundsException - ArrayIndexOutOfBoundsException: invalid array index. -
StringIndexOutOfBoundsException: invalid string index. - NegativeArraySizeException: array created with negative
size. - NullPointerException: dereference of null. - UnsupportedOperationException: operation not supported. -
Checked exceptions (must declare or handle) - ClassNotFoundException: classloader cannot find a class. -
CloneNotSupportedException: object not cloneable. - InterruptedException: thread interrupted while waiting/sleeping. -
ReflectiveOperationException: reflection-related errors (InstantiationException, IllegalAccessException,
InvocationTargetException, NoSuchMethodException). - Exception subclasses added in recent JDKs: MatchException
(pattern matching failures).
2. [Link] (I/O related exceptions)
IOException (checked) - Generic I/O failure. - FileNotFoundException: file missing or path incorrect. - EOFException:
unexpected end of stream. - InterruptedIOException: I/O interrupted. - ObjectStreamException: problems with object
serialization (InvalidClassException, NotSerializableException). - UnsupportedEncodingException: charset not
supported. - UTFDataFormatException: malformed UTF in DataInput.
3. [Link] (Networking)
UnknownHostException: DNS lookup failure. MalformedURLException: invalid URL syntax. SocketException: socket
error (bind, connect, etc.). ProtocolException: protocol-level error. ConnectException: failed to connect to remote host.
HttpRetryException: HTTP request should be retried.
4. [Link] (Database)
SQLException: problems interacting with a database (checked). - SQLSyntaxErrorException: syntactically incorrect
SQL. - SQLTimeoutException: query timed out. - SQLIntegrityConstraintViolationException: constraint violation. -
SQLFeatureNotSupportedException: JDBC feature unsupported.
5. [Link] (New I/O / buffers / channels)
BufferOverflowException (runtime): writing beyond buffer capacity. BufferUnderflowException (runtime): reading when
no remaining elements. ClosedChannelException (checked): channel closed unexpectedly. InvalidMarkException
(runtime): mark invalidated. MalformedInputException (checked): input bytes not decodable to charset.
6. [Link] (Concurrency)
TimeoutException (checked in some APIs; runtime usages exist): operation timed out. CancellationException (runtime):
task was cancelled. ExecutionException (checked/wrapper): exception thrown during task execution (wraps cause).
RejectedExecutionException (runtime): task cannot be accepted by executor. IllegalMonitorStateException (runtime):
wait/notify without owning monitor.
7. [Link] (Remote Method Invocation)
RemoteException (checked): remote invocation failed. - MarshalException: problem marshalling/unmarshalling
parameters. - NoSuchObjectException: remote object not available. - ServerException: server-side exception wrapper.
8. Parsing / format exceptions
ParseException (checked): text cannot be parsed to expected format (dates, etc.). NumberFormatException (runtime):
string not a valid number. DateTimeParseException (runtime/unchecked in [Link]): error parsing date/time string.
9. Reflection / Method Handle / Lookup
InvocationTargetException (checked): exception thrown by invoked method (wraps cause). IllegalAccessException
(checked): reflective access denied. NoSuchMethodException / NoSuchFieldException (checked): requested member
not found.
10. Security / permissions
SecurityException (runtime): security manager denies operation. AccessControlException (runtime, in security
package): specific access control failure.
11. Miscellaneous common exceptions
IllegalArgumentException: invalid argument passed to method. UnsupportedOperationException: operation not
supported by this implementation. IllegalStateException: object not in appropriate state for requested operation.
ServiceConfigurationError (error): provider-configuration files are malformed.
Notes and sources:
Notes: - This document focuses on standard library exceptions and errors present in Java SE 21. - The Java API
(Javadoc) is the authoritative source for the exact, complete list and hierarchy. See [Link] package and related
packages in the Java SE 21 API for complete details. - New exception classes added in modern JDKs include
[Link] (added ~JDK 19/21 family) among a few others. Sources: - Java SE 21 API ([Link]
package summary and class pages) - Java SE 21 New API List