From c0a65e037c9828e8f5229d65f69def463ae7e473 Mon Sep 17 00:00:00 2001 From: gered Date: Fri, 14 Apr 2017 12:40:48 -0400 Subject: [PATCH] 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) --- manual-bwapi-src/Mirror.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/manual-bwapi-src/Mirror.java b/manual-bwapi-src/Mirror.java index 165469d..379c7b8 100644 --- a/manual-bwapi-src/Mirror.java +++ b/manual-bwapi-src/Mirror.java @@ -76,11 +76,17 @@ public class Mirror { 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 { - String arch = System.getProperty("os.arch"); - if(!arch.equals("x86")){ - throw new UnsupportedOperationException("BWMirror API supports only x86 architecture."); - } + if (is64BitJRE()) + throw new UnsupportedOperationException("BWMirror must be run on a 32-bit JRE/JDK."); if (!extractAndLoadNativeLibraries()) System.exit(1);