I have a static initialization block. It sets up logging to a file. If something goes wrong, I simply want to break out of the static block. Is this possible? I know I could use an if/else approach, but using a simple break would make the code much more readable.
Share
You probably want to catch all exceptions:
But beware: loading the class won’t fail, but some or all static fields could be in an inconsistent state.