private static void checkNativeLibraryLoaded() { if (!nativeLibraryLoaded) { String vendorName = LibraryLoader.computeLibraryShortName(true); String baseName = LibraryLoader.computeLibraryShortName(false); String message = "J2V8 native library not loaded (" + baseName + "/" + vendorName + ")"; if (nativeLoadError != null) { throw new IllegalStateException(message, nativeLoadError); } else if (nativeLoadException != null) { throw new IllegalStateException(message, nativeLoadException); } else { throw new IllegalStateException(message); } } }
public static String computeLibraryFullName(boolean withLinuxVendor) { return "lib" + computeLibraryShortName(withLinuxVendor) + "." + PlatformDetector.OS.getLibFileExtension(); }
static boolean tryLoad(boolean withLinuxVendor, StringBuffer message) { String libShortName = computeLibraryShortName(withLinuxVendor); String libFullName = computeLibraryFullName(withLinuxVendor); String ideLocation = System.getProperty("user.dir") + SEPARATOR + "jni" + SEPARATOR + libFullName; /* Try loading library from java library path */ if (load(libFullName, message)) { return true; } if (load(libShortName, message)) { return true; } /* Try loading library from the IDE location */ if (new File(ideLocation).exists()) { if (load(ideLocation, message)) { return true; } } return false; }
private static void checkNativeLibraryLoaded() { if (!nativeLibraryLoaded) { String vendorName = LibraryLoader.computeLibraryShortName(true); String baseName = LibraryLoader.computeLibraryShortName(false); String message = "J2V8 native library not loaded (" + baseName + "/" + vendorName + ")"; if (nativeLoadError != null) { throw new IllegalStateException(message, nativeLoadError); } else if (nativeLoadException != null) { throw new IllegalStateException(message, nativeLoadException); } else { throw new IllegalStateException(message); } } }
public static String computeLibraryFullName(boolean withLinuxVendor) { return "lib" + computeLibraryShortName(withLinuxVendor) + "." + PlatformDetector.OS.getLibFileExtension(); }
static boolean tryLoad(boolean withLinuxVendor, StringBuffer message) { String libShortName = computeLibraryShortName(withLinuxVendor); String libFullName = computeLibraryFullName(withLinuxVendor); String ideLocation = System.getProperty("user.dir") + SEPARATOR + "jni" + SEPARATOR + libFullName; /* Try loading library from java library path */ if (load(libFullName, message)) { return true; } if (load(libShortName, message)) { return true; } /* Try loading library from the IDE location */ if (new File(ideLocation).exists()) { if (load(ideLocation, message)) { return true; } } return false; }
private void performTests(final String expectedOsName, final String expectedVendor, final String expectedLibExtension) { String libName = LibraryLoader.computeLibraryShortName(true); String[] parts = libName.split("-"); libName = LibraryLoader.computeLibraryShortName(false); parts = libName.split("-");
private static String computeLibraryFullName() { return "lib" + computeLibraryShortName() + "." + getOSFileExtension(); }
private static String computeLibraryFullName() { return "lib" + computeLibraryShortName() + "." + getOSFileExtension(); }
String libShortName = computeLibraryShortName(); String libFullName = computeLibraryFullName(); String ideLocation = System.getProperty("user.dir") + SEPARATOR + "jni" + SEPARATOR + computeLibraryFullName();
String libShortName = computeLibraryShortName(); String libFullName = computeLibraryFullName(); String ideLocation = System.getProperty("user.dir") + SEPARATOR + "jni" + SEPARATOR + computeLibraryFullName();