Java Library Load loadLibrary(String filename, String targetLibFolder)

Here you can find the source of loadLibrary(String filename, String targetLibFolder)

Description

Load the JNI library directly by using the file name

License

Apache License

Parameter

Parameter Description
filename a parameter
targetLibFolder a parameter

Declaration

public static boolean loadLibrary(String filename, String targetLibFolder) 

Method Source Code

//package com.java2s;
/*// w w w.  j  av  a 2  s.c om
 *  Copyright 2014 AT&T
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

import java.io.File;

public class Main {
    /**
     * Load the JNI library directly by using the file name
     * 
     * @param filename
     * @param targetLibFolder
     */
    public static boolean loadLibrary(String filename, String targetLibFolder) {
        try {
            System.load(targetLibFolder + File.separator + filename);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

Related

  1. loadSystemLibrary(String filename)
  2. loadSystemLibrary(String library)