Beispiel

public class Example {
public void run() {
throw new Error( "Problem" ); //$NON-NLS-1$
}
}

Lösung
  1. Erweitern Sie 'java.lang.Exception'.
  2. Ändern Sie die throws-Klausel so, dass diese neue Ausnahmebedingung verwendet wird.

public static class ExceptionSubclass extends Exception {
public ExceptionSubclass( String s ){
super(s);
}
}

public class Example {
public void run() throws ExceptionSubclass {
throw new ExceptionSubclass( "Problem" ); //$NON-NLS-1$
}
}