diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-11-15 17:41:15 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-11-15 18:30:57 +0000 |
commit | 0c28c2aad6bfebf436c13a06db70413166d15d6d (patch) | |
tree | f19d3465c12b572ebb283cdb4748149e0adade07 /platform/java/src/com/artifex | |
parent | e84b0b0354a7ecf474600f55e1799d72affc2dfd (diff) | |
download | mupdf-0c28c2aad6bfebf436c13a06db70413166d15d6d.tar.xz |
Update JNI code to load 32 or 64 bit DLL as appropriate.
Make the JNI code detect whether it is running on a 32 or
64 bit machine, and change the name of the DLL appropriately.
Update Android Makefile to make mupdf_java32 instead of mupdf_java.
Update Java Makefile to make mupdf_java32 or mupdf_java64 based
on the system it is running on. This choice can be overruled by
defining BITS to be "32" or "64" before calling make.
Update Windows Solution to make mupdf_java32 or mupdf_java64 as
appropriate.
Diffstat (limited to 'platform/java/src/com/artifex')
-rw-r--r-- | platform/java/src/com/artifex/mupdf/fitz/Context.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Context.java b/platform/java/src/com/artifex/mupdf/fitz/Context.java index d8edf378..3ee91822 100644 --- a/platform/java/src/com/artifex/mupdf/fitz/Context.java +++ b/platform/java/src/com/artifex/mupdf/fitz/Context.java @@ -15,12 +15,24 @@ public class Context public static void init() { if (!inited) { inited = true; - System.loadLibrary("mupdf_java"); + System.loadLibrary(getLibraryName()); if (initNative() < 0) throw new RuntimeException("cannot initialize mupdf library"); } } + private static String getLibraryName(void) { + /* 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"; + } + String val = System.getProperty("sun.arch.data.model"); + if (val != null && val.equals("32")) { + return "mupdf_java32" + } + return "mupdf_java64"; + } + static { init(); } // FIXME: We should support the store size being changed dynamically. |