bit more of a robust method of checking if running on a 32-bit jvm

os.arch can have a wide variety of values (e.g. not just "x86" for
32 bit)
This commit is contained in:
Gered 2017-04-14 12:40:48 -04:00
parent e5721392c6
commit c0a65e037c

View file

@ -76,11 +76,17 @@ public class Mirror {
return true; return true;
} }
public static boolean is64BitJRE() {
String bits = System.getProperty("sun.arch.data.model");
if (bits == null)
return System.getProperty("java.vm.name").contains("64");
else
return bits.equals("64");
}
static { static {
String arch = System.getProperty("os.arch"); if (is64BitJRE())
if(!arch.equals("x86")){ throw new UnsupportedOperationException("BWMirror must be run on a 32-bit JRE/JDK.");
throw new UnsupportedOperationException("BWMirror API supports only x86 architecture.");
}
if (!extractAndLoadNativeLibraries()) if (!extractAndLoadNativeLibraries())
System.exit(1); System.exit(1);