public static void main(String[] args) { if(args.length >= 1) { if("--os".equals(args[0])) { System.out.print(getOSName()); return; } else if("--arch".equals(args[0])) { System.out.print(getArchName()); return; } } System.out.print(getNativeLibFolderPathForCurrentOS()); }
public static String getArchName() { String osArch = System.getProperty("os.arch"); // For Android if(isAndroid()) { return "android-arm"; } if(osArch.startsWith("arm")) { osArch = resolveArmArchType(); } else { String lc = osArch.toLowerCase(Locale.US); if(archMapping.containsKey(lc)) return archMapping.get(lc); } return translateArchNameToFolderName(osArch); }
public static String getOSName() { return translateOSNameToFolderName(System.getProperty("os.name")); }
public static String getNativeLibFolderPathForCurrentOS() { return getOSName() + "/" + getArchName(); }
private static String getArchitecture() { String name = OSInfo.getArchName(); if (name.equals(ARCH_32) || name.equals(ARCH_64)) { return name; } return ARCH_64; }
String os = OSInfo.getOSName(); if (os == null || os.equalsIgnoreCase("mac") == false) { //$NON-NLS-1$ if (LOG.isDebugEnabled()) {
static String resolveArmArchType() { if(System.getProperty("os.name").contains("Linux")) { String armType = getHardwareName();
snappyNativeLibraryPath = "/org/xerial/snappy/native/" + OSInfo.getNativeLibFolderPathForCurrentOS(); boolean hasNativeLib = hasResource(snappyNativeLibraryPath + "/" + snappyNativeLibraryName); if (!hasNativeLib) { if (OSInfo.getOSName().equals("Mac")) { String errorMessage = String.format("no native library is found for os.name=%s and os.arch=%s", OSInfo.getOSName(), OSInfo.getArchName()); throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, errorMessage);