summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-11-15 19:29:00 +0000
committerRobin Watts <robin.watts@artifex.com>2016-11-15 19:52:39 +0000
commitd11ed8c4d7816cfe40181178c2150c8056d388f9 (patch)
tree95d6fbd6ec861f92f4ec7bbee3f923ebcdd0ac6d /platform
parent0c28c2aad6bfebf436c13a06db70413166d15d6d (diff)
downloadmupdf-d11ed8c4d7816cfe40181178c2150c8056d388f9.tar.xz
Fix Java 32/64bit detection.
Fix some java typos. Thanks to Fred for nicely pointing out that I'd been testing the wrong build. Also, make us default to 32bit if sun.arch.data.model is not defined, as Android doesn't set this. We will need to find a nice way to spot 32/64 bittedness on Android.
Diffstat (limited to 'platform')
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/Context.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Context.java b/platform/java/src/com/artifex/mupdf/fitz/Context.java
index 3ee91822..60de22e6 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/Context.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/Context.java
@@ -21,16 +21,30 @@ public class Context
}
}
- private static String getLibraryName(void) {
+ private static String getLibraryName() {
/* Mac OS always uses 64bit DLLs for any JDK 1.7 or above */
if (System.getProperty("os.name").toLowerCase().contains("mac os")) {
return "mupdf_java64";
}
+ /* Sun and OpenJDK JVMs support this way of finding bittedness */
String val = System.getProperty("sun.arch.data.model");
- if (val != null && val.equals("32")) {
- return "mupdf_java32"
+ /* Android does NOT support this, and returns NULL */
+ if (val != null && val.equals("64")) {
+ return "mupdf_java64";
}
- return "mupdf_java64";
+
+ /* We might be running Android here. We could find out by
+ * doing the following test:
+ * val = System.getProperty("java.vm.name");
+ * if (val != null && val.toLowerCase().contains("dalvik")) {
+ * ...Do something Androidy to test for 32/64 here...
+ * }
+ * (Currently, both Dalvik and ART return 'Dalvik').
+ * We know of no portable way to detect 32 or 64bittedness
+ * on android though, so for now will assume 32.
+ */
+
+ return "mupdf_java32";
}
static { init(); }