public static void loadLibrary() { NativeLibraryLoader.loadLibrary("us.ihmc.robotics.hierarchicalKinematics", "hik_java"); } }
/** * Convenience method to load a single library that's available on all platforms. Throws a UnsatisfiedLinkError if the library cannot be found. * * @param packageName * @param libraryName */ public static void loadLibrary(String packageName, String libraryName) { if (!loadLibrary(new DefaultNativeLibraryDescription(packageName, libraryName))) { throw new UnsatisfiedLinkError("Cannot load " + createPackagePrefix(packageName) + libraryName); } }
/** * Extract the library if necessary, returns full path to the library. Useful for JNA libraries. * * @param packageName Name of the package * @param libraryName Name of the library * @return Full path to the library. */ public static String extractLibrary(String packageName, String libraryName) { return extractLibraryAbsolute(packageName, System.mapLibraryName(libraryName)); }
if (SystemUtils.IS_OS_WINDOWS && isX86_64()) else if (SystemUtils.IS_OS_MAC && isX86_64()) else if (SystemUtils.IS_OS_LINUX && isX86_64()) String packageName = libraryDescription.getPackage(); String[] libraries = libraryDescription.getLibraries(platform); if (libraries == null || libraries.length == 0) loadLibraryFromClassPath(packageName, library);
File firstLibrary = new File(extractLibrary(packageName, mainLibrary)); File containingDirectory = firstLibrary.getParentFile(); String prefix = createPackagePrefix(packageName); for (String library : libraries)
Native.register(NativeLibraryLoader.extractLibrary("us.ihmc.ihmcPerception.linemod", "linemod_interface"));
public static String extractLibraryAbsolute(String packageName, String library) String prefix = createPackagePrefix(packageName); URL libraryURL = NativeLibraryLoader.class.getClassLoader().getResource(prefix + library); File lib = writeStreamToFile(stream, library, directory);
public static void loadLibraries() { String absolutePathToDirectory; if (SystemUtils.IS_OS_WINDOWS) { absolutePathToDirectory = NativeLibraryLoader.extractLibraries("", "jinput-raw", "jinput-raw_64", "jinput-dx8_64", "jinput-dx8", "jinput-wintab"); } else if (SystemUtils.IS_OS_LINUX) { absolutePathToDirectory = NativeLibraryLoader.extractLibraries("", "jinput-linux64", "jinput-linux"); } else if (SystemUtils.IS_OS_MAC) { absolutePathToDirectory = new File(NativeLibraryLoader.extractLibraryAbsolute("", "libjinput-osx.jnilib")).getParent(); } else { return; } System.setProperty("net.java.games.input.librarypath", absolutePathToDirectory); } }
@Override public void loadLibrary() { NativeLibraryLoader.loadLibrary("jassimp", "jassimp"); } }
/** * Convenience method to load a single library that's available on all platforms. Throws a UnsatisfiedLinkError if the library cannot be found. * * @param packageName * @param libraryName */ public static void loadLibrary(String packageName, String libraryName) { if (!loadLibrary(new DefaultNativeLibraryDescription(packageName, libraryName))) { throw new UnsatisfiedLinkError("Cannot load " + createPackagePrefix(packageName) + libraryName); } }
if (SystemUtils.IS_OS_WINDOWS && isX86_64()) else if (SystemUtils.IS_OS_MAC && isX86_64()) else if (SystemUtils.IS_OS_LINUX && isX86_64()) String packageName = libraryDescription.getPackage(); String[] libraries = libraryDescription.getLibraries(platform); if (libraries == null || libraries.length == 0) loadLibraryFromClassPath(packageName, library);
File firstLibrary = new File(extractLibrary(packageName, mainLibrary)); File containingDirectory = firstLibrary.getParentFile(); String prefix = createPackagePrefix(packageName); for (String library : libraries)
/** * Extract the library if necessary, returns full path to the library. Useful for JNA libraries. * * @param packageName Name of the package * @param libraryName Name of the library * @return Full path to the library. */ public static String extractLibrary(String packageName, String libraryName) { return extractLibraryAbsolute(packageName, System.mapLibraryName(libraryName)); }
Native.register(NativeLibraryLoader.extractLibrary("us.ihmc.ihmcPerception.linemod", "linemod_interface"));
public static String extractLibraryAbsolute(String packageName, String library) String prefix = createPackagePrefix(packageName); URL libraryURL = NativeLibraryLoader.class.getClassLoader().getResource(prefix + library); File lib = writeStreamToFile(stream, library, directory);
public static void loadNativeLibraries() { for (int i = 0; i < nativeLibraryCandidates.length; i++) { try { NativeLibraryLoader.loadLibrary("us.ihmc.commonWalkingControlModules.lib", nativeLibraryCandidates[i]); break; } catch (UnsatisfiedLinkError e) { if (i == (nativeLibraryCandidates.length - 1)) throw (e); } } }
private synchronized static void loadLibraryFromClassPath(String packageName, String library) { String identifier = packageName + "+" + library; if (!loadedLibraries.contains(identifier)) { System.load(extractLibraryAbsolute(packageName, library)); loadedLibraries.add(identifier); } }
public FastRTPSDomain() { try { NativeLibraryLoader.loadLibrary("us.ihmc.rtps.impl.fastRTPS", "FastRTPSWrapper"); } catch(UnsatisfiedLinkError e) { if(SystemUtils.IS_OS_WINDOWS) { throw new UnsatisfiedLinkError("Cannot load library, make sure to install Microsoft Visual C++ 2017 Redistributable (x64) (https://go.microsoft.com/fwlink/?LinkId=746572) "); } else { throw e; } } Runtime.getRuntime().addShutdownHook(new Thread((Runnable) () -> { stopAll(); })); }
private synchronized static void loadLibraryFromClassPath(String packageName, String library) { String identifier = packageName + "+" + library; if (!loadedLibraries.contains(identifier)) { System.load(extractLibraryAbsolute(packageName, library)); loadedLibraries.add(identifier); } }
public static void main(String[] arg) throws IOException NativeLibraryLoader.loadLibrary("org.opencv", OpenCVTools.OPEN_CV_LIBRARY_NAME); VideoCapture cap = new VideoCapture(1); OpenCVFaceDetector faceDetector = new OpenCVFaceDetector(0.5);