Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think that you are basically stuffed.</p> <p>Yes, it is (in theory at least) possible to block the call <code>System.exit()</code> via a security manager. But what happens then?</p> <ol> <li>Static initializer in class attempts to call <code>System.exit()</code>.</li> <li>SecurityManager says no you can't and throws SecurityException</li> <li>Static initialization of the class fails with uncaught exception</li> <li>Initialization of the class you were originally trying to initialize (implicitly) fails.</li> </ol> <p>You can in theory catch the exception. But that doesn't get you very far, because the JVM will only <strong>attempt</strong> to perform static initialization once. If that fails, and you try again, the JVM will simply throw <code>ClassNotFoundError</code> (I think), repeating the original exception as the cause.</p> <p>The only way to get the class initialization to happen again is to <strong>throw away</strong> the classloader that loaded the offending classes in the first place, create a new one, and start loading again. And then you are back to the original problem.</p> <p>Bottom line: if you really can't change the code, you are stuffed.</p> <hr> <p>Even if you could make this work, it sounds like a poor solution / non-solution to your problem. The LinkageError exception means that the library has failed to load a native library, and that the corresponding <code>native</code> method calls into the library will fail with an <code>Error</code>. At best you'll end up with a library where some bits work and others don't.</p> <p>You should focus on obtaining the right native library for your platform and/or configuring the JVM so that it can find it. Or finding a better alternative to the 3rd-party library that isn't encumbered with intrusive license enforcement crap.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload