Home » Java Basics » exceptions

exceptions

java.lang.ClassNotFoundException – How to solve Class Not Found Exception

In this tutorial, we will discuss the java.lang.classnotfoundexception – ClassNotFoundException. This exception is thrown when an application tries to load a class through its string name, but no definition for the specified class name could be found. A class can be loaded using one of the following methods: The forName method that resides inside the Class class.The findSystemClass method that ...

Read More »

java.io.ObjectStreamException – How to solve Object Stream Exception

In this tutorial we will discuss about ObjectStreamException. This exception is defined as the superclass of all exceptions specific to Object Stream classes. The ObjectStreamException is defined as an abstract class and thus, an instance of ObjectStreamException cannot be created. Also, the ObjectStreamException extends the IOException class, which signals that an I/O exception has occurred. There is a number of ...

Read More »

java.lang.IllegalArgumentException – How to solve Illegal Argument Exception

In this tutorial, we will discuss how to solve the java.lang.illegalargumentexception – IllegalArgumentException in Java. This exception is thrown in order to indicate that a method has been passed an illegal or inappropriate argument. For example, if a method requires a non-empty string as a parameter and the input string equals to null, the IllegalArgumentException is thrown to indicate that ...

Read More »

java.lang.unsupportedclassversionerror – How to handle Unsupported Class Version Error

In this tutorial we will discuss about Java’s UnsupportedClassVersionError and how to deal with it. The UnsupportedClassVersionError is a sub-class of the LinkageError class and specifically, of the ClassFormatError class. This error is thrown by the Java Virtual Machine (JVM) when it tries to read a class file whose major and minor version numbers are not supported. This error exists ...

Read More »

java.lang.unsatisfiedlinkerror – How to handle Unsatisfied Link Error

In this tutorial we will discuss about Java’s UnsatisfiedLinkError and how to deal with it. The UnsatisfiedLinkError is a sub-class of the LinkageError class and denotes that the Java Virtual Machine (JVM) cannot find an appropriate native-language definition of a method declared as native. This error exists since the first release of Java (1.0) and is thrown only at runtime. ...

Read More »

java.lang.exceptionininitializererror – How to handle Exception Initializer Error

In this tutorial we will discuss about Java’s ExceptionInInitializerError and how to deal with it. The ExceptionInInitializerError is a sub-class of the LinkageError class and denotes that an unexpected exception has occurred in a static initializer or the initializer for a static variable. As of Java release 1.4, this error conforms to the general purpose exception-chaining mechanism. The ExceptionInInitializerError is ...

Read More »

java.util.concurrentmodificationexception – How to handle Concurrent Modification Exception

The ConcurrentModificationException is a RuntimeException that may be thrown by methods that have detected concurrent modification of an object, when such modification is not permissible. An example of not permissible behavior is when a thread tries to modify the internal structure of a Collection, while another thread is iterating over it. In general, the results of the iteration are undefined. ...

Read More »

java.lang.reflect.invocationtargetexception – How to handle Invocation Target Exception

Reflection is commonly used by programs which require the ability to examine or modify the runtime behavior of applications running in the Java Virtual Machine. The reflection layer wraps any thrown exception as an InvocationTargetException. In this way, it is clear whether the exception was actually caused by a failure in the reflection call, or a failure within the method ...

Read More »