Java Properties Load from File loadLibrary(String libFileName)

Here you can find the source of loadLibrary(String libFileName)

Description

Attempts to load the given library from all paths in java.libary.path.

License

Apache License

Declaration

public static void loadLibrary(String libFileName) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

import java.io.File;

public class Main {
    /**// w  ww. j av a  2s  .c  o  m
     * Attempts to load the given library from all paths in java.libary.path.
     * Throws a RuntimeException if the library was unable to be loaded from
     * any location.
     */
    public static void loadLibrary(String libFileName) {
        boolean found = false;
        String javaLibPath = System.getProperty("java.library.path");
        for (String path : javaLibPath.split(":")) {
            File libFile = new File(path + File.separator + libFileName);
            if (libFile.exists()) {
                System.load(libFile.getPath());
                found = true;
                break;
            }
        }
        if (!found) {
            throw new RuntimeException("Failed to load " + libFileName
                    + " from any " + "location in java.library.path ("
                    + javaLibPath + ").");
        }
    }
}

Related

  1. loadIncludes(String propertyName, boolean mandatory, File file, Properties configProps)
  2. loadInputAsString(InputStream is)
  3. loadInstallProps()
  4. loadJZ(File file)
  5. loadKeys(String propertiesFileName, InputStream in)
  6. loadLibrarySmart(String libraryName)
  7. loadLocalization(final ZipFile file, final String loc)
  8. loadLocatorInfo(String fileName)
  9. loadLWJGL()