Java Exceptions | Generated by AI
Here’s an extensive list of Java exceptions, categorized into Checked Exceptions, Unchecked Exceptions (Runtime), and Errors.
1. Checked Exceptions (Must be handled or declared using throws
)
- IOException – General I/O failure.
- FileNotFoundException – File is missing or inaccessible.
- InterruptedException – Thread interruption occurs.
- SQLException – Issues related to database access.
- ParseException – Error while parsing data formats.
- MalformedURLException – Invalid URL format.
- ClassNotFoundException – Class is not found at runtime.
- InstantiationException – Cannot instantiate an abstract class or interface.
- IllegalAccessException – Access to a class, method, or field is not allowed.
- NoSuchMethodException – Method does not exist.
- NoSuchFieldException – Field does not exist in the class.
- TimeoutException – A blocking operation timed out.
- UnsupportedEncodingException – Encoding is not supported.
- URISyntaxException – Invalid URI syntax.
- NotBoundException – Name not found in an RMI registry.
- AlreadyBoundException – Name already bound in an RMI registry.
- CloneNotSupportedException – Object does not implement
Cloneable
. - DataFormatException – Invalid format in compressed data.
- EOFException – Unexpected end of file reached.
- NotSerializableException – Object is not serializable.
- LineUnavailableException – Audio line is unavailable.
- UnsupportedAudioFileException – Unsupported audio file format.
- PrinterException – Printing operation failure.
- ReflectiveOperationException – General reflection error.
- ExecutionException – Exception during concurrent task execution.
- ScriptException – Issues with executing scripts.
- TransformerException – XML transformation failure.
- XPathExpressionException – Invalid XPath expression.
- SAXException – Issues with XML parsing.
- JAXBException – Issues with XML binding.
- MarshalException – Error while marshalling XML data.
- UnmarshalException – Error while unmarshalling XML data.
- DatatypeConfigurationException – Invalid XML data type configuration.
- GSSException – Issues with GSS security operations.
- KeyStoreException – Problems with Java KeyStore.
- CertificateException – Problems with certificate processing.
- InvalidKeyException – Invalid key in cryptographic operations.
- NoSuchAlgorithmException – Requested cryptographic algorithm is not available.
- NoSuchProviderException – Requested security provider is not available.
- UnrecoverableKeyException – Cannot recover a key from KeyStore.
- IllegalBlockSizeException – Invalid block size for encryption.
- BadPaddingException – Padding error in cryptography.
2. Unchecked Exceptions (Runtime Exceptions)
- NullPointerException – Accessing an object reference that is
null
. - ArrayIndexOutOfBoundsException – Accessing an invalid array index.
- StringIndexOutOfBoundsException – Accessing an invalid string index.
- ArithmeticException – Math errors like division by zero.
- NumberFormatException – Converting an invalid string to a number.
- ClassCastException – Invalid type casting.
- IllegalArgumentException – Invalid argument passed to a method.
- IllegalStateException – Method called at an invalid state.
- UnsupportedOperationException – Method is not supported.
- ConcurrentModificationException – Concurrent modification of a collection.
- NoSuchElementException – Attempting to access a non-existent element in a collection.
- IllegalMonitorStateException – Thread synchronization error.
- NegativeArraySizeException – Creating an array with a negative size.
- StackOverflowError – Infinite recursion leading to stack overflow.
- OutOfMemoryError – JVM runs out of memory.
- SecurityException – Security violation detected.
- MissingResourceException – Resource bundle not found.
- EmptyStackException – Attempting to access an element from an empty stack.
- TypeNotPresentException – Type not found at runtime.
- EnumConstantNotPresentException – Invalid enum constant.
- UncheckedIOException – Unchecked version of
IOException
. - DateTimeException – Errors related to Java’s date-time API.
- InvalidClassException – Issues with deserializing a class.
- IllegalCharsetNameException – Invalid character set name.
- UnsupportedCharsetException – Charset is not supported.
- ProviderNotFoundException – Required service provider is missing.
- PatternSyntaxException – Invalid regular expression syntax.
- InvalidPathException – Invalid file path.
- ReadOnlyBufferException – Attempting to modify a read-only buffer.
- BufferUnderflowException – Buffer underflow occurs.
- BufferOverflowException – Buffer overflow occurs.
- FileSystemAlreadyExistsException – File system already exists.
- FileSystemNotFoundException – File system is not found.
- ClosedWatchServiceException – Watch service is closed.
- UncheckedExecutionException – Issues in concurrent task execution.
3. Errors (Serious issues that should not be caught)
- StackOverflowError – Too many recursive method calls.
- OutOfMemoryError – JVM runs out of memory.
- VirtualMachineError – Critical JVM error.
- InternalError – Unexpected internal JVM error.
- UnknownError – Unknown critical error.
- AssertionError – Assertion failed using
assert
. - NoClassDefFoundError – Class definition is missing at runtime.
- IncompatibleClassChangeError – Incompatible changes to a class.
- AbstractMethodError – Abstract method is not implemented.
- InstantiationError – Instance creation failure.
- IllegalAccessError – Illegal access to a class or method.
- NoSuchMethodError – Method is not found.
- NoSuchFieldError – Field is not found.
- ClassFormatError – Invalid class format.
- UnsupportedClassVersionError – Java class compiled with an unsupported version.
- AnnotationFormatError – Issues with Java annotations.
- ExceptionInInitializerError – Exception in a static initializer block.
- ThreadDeath – Thread forcibly terminated.
- ServiceConfigurationError – Service provider configuration issue.
- BootstrapMethodError – Error in dynamic language support.
- VerifierError – Bytecode verification failure.
- FactoryConfigurationError – Error in XML factory configuration.
Conclusion
This is a comprehensive list of Java exceptions and errors. If you need more details on any specific exception, let me know! 🚀