public static synchronized void loadLibrary(File jar) throws NoAvailableBackendException {
        try {
            /*We are using reflection here to circumvent encapsulation; addURL is not public*/
            java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
            java.net.URL url = jar.toURI().toURL();
            /*Disallow if already loaded*/
            for (java.net.URL it : java.util.Arrays.asList(loader.getURLs())) {
                if (it.equals(url)) {
                    return;
                }
            }
            java.lang.reflect.Method method =
                            java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {java.net.URL.class});
            method.setAccessible(true); /*promote the method to public access*/
            method.invoke(loader, new Object[] {url});
        } catch (final java.lang.NoSuchMethodException | java.lang.IllegalAccessException
                        | java.net.MalformedURLException | java.lang.reflect.InvocationTargetException e) {
            throw new NoAvailableBackendException(e);
        }
    }
public static synchronized void loadLibrary ( File jar ) throws NoAvailableBackendException { try { java . net . URLClassLoader loader = ( java . net . URLClassLoader ) ClassLoader . getSystemClassLoader ( ) ; java . net . URL url = jar . toURI ( ) . toURL ( ) ; for ( java . net . URL it : java . util . Arrays . asList ( loader . getURLs ( ) ) ) { if ( it . equals ( url ) ) { return ; } } java . lang . reflect . Method method = java . net . URLClassLoader . class . getDeclaredMethod ( "addURL" , new Class [ ] { java . net . URL . class } ) ; method . setAccessible ( true ) ; method . invoke ( loader , new Object [ ] { url } ) ; } catch ( final java . lang . NoSuchMethodException | java . lang . IllegalAccessException | java . net . MalformedURLException | java . lang . reflect . InvocationTargetException e ) { throw new NoAvailableBackendException ( e ) ; } }
Adds the supplied Java Archive library to java.class.path. This is benign
if the library is already loaded.
@param jar the jar file to add
@throws NoAvailableBackendException