public static String mapLibraryName(String libname) { return System.mapLibraryName(libname); } }
public static String mapLibraryName(String libname) { return System.mapLibraryName(libname); } }
/** * @return Maps library name to file name. */ private static String mapLibraryName(String name) { String libName = System.mapLibraryName(name); if (U.isMacOs() && libName.endsWith(".jnilib")) return libName.substring(0, libName.length() - "jnilib".length()) + "dylib"; return libName; }
private static void loadLib(String path, String name) { name = System.mapLibraryName(name); // extends name with .dll, .so or .dylib try { InputStream in = ACWrapper.class.getResourceAsStream("/"+path + name); File fileOut = new File("your lib path"); OutputStream out = FileUtils.openOutputStream(fileOut); IOUtils.copy(in, out); in.close(); out.close(); System.load(fileOut.toString());//loading goes here } catch (Exception e) { //handle } }
/** * Make a call to {@link System#loadLibrary(String)} to load the native library which assumes * that the library is available on the path based on this {@link Bundle}'s {@link Manifest}. */ public void start(BundleContext context) throws Exception { String library = System.mapLibraryName(LIBRARY_NAME); if (library.toLowerCase().endsWith(".dylib")) { // some MacOS JDK7+ vendors map to dylib instead of jnilib library = library.replace(".dylib", ".jnilib"); } System.loadLibrary(library); SnappyLoader.setSnappyApi(new SnappyNative()); }
/** * Finds a native library. This class loader first searches its own library * path (as specified in the constructor) and then the system library path. * In Android 2.2 and earlier, the search order was reversed. * * @param libname * The name of the library to find * @return the complete path of the library, or {@code null} if the library * is not found. */ public String findLibrary(String libname) { init(); String fileName = System.mapLibraryName(libname); for (String pathElement : libraryPathElements) { String pathName = pathElement + fileName; File test = new File(pathName); if (test.exists()) { return pathName; } } return null; }
System.load(path + "/" + System.mapLibraryName(libBaseName)); return true; } catch (UnsatisfiedLinkError e) {
p.put("platform", name); p.put("platform.path.separator", File.pathSeparator); String s = System.mapLibraryName("/"); int i = s.indexOf('/'); p.put("platform.library.prefix", s.substring(0, i));
snappyNativeLibraryName = System.mapLibraryName("snappyjava");
String libname = System.mapLibraryName(name); String path = NATIVE_RESOURCE_HOME + libname;
File libraryPath = new File(libDir, System.mapLibraryName(library)); if (libraryPath.exists()) { System.load(libraryPath.getPath());
String libname = System.mapLibraryName(name); String path = NATIVE_RESOURCE_HOME + libname;
String libname = System.mapLibraryName(name); String path = NATIVE_RESOURCE_HOME + libname;
handle = Dl.open(null); } else { String libName = System.mapLibraryName(name); for (String searchPath : searchPaths) { File f = new File(searchPath, libName);
String filename = System.mapLibraryName(libraryName); List<String> candidates = new ArrayList<String>(); String lastError = null;
final String mappedSurfaceLibraryName = System.mapLibraryName(LibraryLoader.SURFACE_LIBRARY_NAME); final FilenameFilter filter = new FilenameFilter() { @Override
String libname = System.mapLibraryName(name); String path = NATIVE_RESOURCE_HOME + libname;
@Override public String mapLibraryName(final String libraryName) { if (libraryName.startsWith("lib") && libraryName.endsWith(".so")) { // Already mapped return libraryName; } return System.mapLibraryName(libraryName); }
private File copyNativeLibrary(String name, String libraryPath) { final String nativeLibName = System.mapLibraryName(name); final File tempLibrary = new File(artifactTempFolder, nativeLibName + System.currentTimeMillis()); try { final File library = new File(decode(libraryPath, defaultCharset().name())); copyFile(library, tempLibrary); return tempLibrary; } catch (IOException e) { throw new IllegalStateException(String.format("Unable to generate copy for native library '%s' at '%s'", nativeLibName, tempLibrary.getAbsolutePath()), e); } }
private String getJniLibFileName() { String libraryFileName = System.mapLibraryName(TEST_LIB_NAME); int index = libraryFileName.lastIndexOf("."); libraryFileName = libraryFileName.substring(0, index) + JNILIB_EXTENSION; return libraryFileName; } }