title: Prevent Java from loading library more than once
body: <p>I have several classes that use the same JNI library, called "jni". In each of those classes, I have a System.loadLibrary() call in the class's static initializer:</p>
  
  <pre><code>Class class1 {
      static{
          System.loadLibrary("jni");
      }
      ...
  }
  
  Class class2 {
      static{
          System.loadLibrary("jni");
      }
      ...
  }
  </code></pre>
  
  <p>The only problem is, I only want System.loadLibrary() to be called once, since it can take a while. Is there an easy and clean way to prevent multiple loadings of the same library?</p>