Visual J# Exceptions
Visual J# application developers must use the following two hierarchies of exceptions:
Java-language exceptions, which are derived from java.lang.Throwable. These exceptions fall into two categories:
Checked exceptions
If a method results in a checked exception being thrown, the compiler issues an error, unless the code that calls the method has a try-catch block to catch the checked exception.
Run-time exceptions
Derived from java.lang.RuntimeException. The compiler does not enforce any catching by the calling code.
.NET Framework exceptions, which are derived from Exception.
Many of the Java-language run-time exceptions have semantic equivalents in the .NET Framework. For example, java.lang.NullPointerException is similar to NullReferenceException.
When you catch a Java-language run-time exception in your source code, the Visual J# compiler ensures that the resulting executable code catches its .NET Framework equivalent as well.
Note
Handled run-time exceptions display in both the debugger and the error console as J# exceptions (as specified in the JDK 1.1.4 specification); unhandled run-time exceptions display in the debugger as .NET exceptions and in the error console as J# exceptions.
Java-language exceptions and their .NET Framework equivalents are listed in the following table.
See Also
Reference
Visual J# Exception Hierarchies
Visual J# Exception Handling for the Debugger