Possible Duplicate:
How to handle a static final field initializer that throws checked exception
In this example, I get the error The blank final field myClass may not have been initialized:
private final static MyClass myClass; // <-- error
static {
try {
myClass = new MyClass(); // <-- throws exception
myClass.init();
} catch (Exception e) {
// log
}
}
In that example, I get the error The final field myClass may already have been assigned:
private final static MyClass myClass;
static {
try {
myClass = new MyClass(); // <-- throws exception
myClass.init();
} catch (Exception e) {
myClass = null; // <-- error
// log
}
}
In there any solution to that issue?