From 0c28c2aad6bfebf436c13a06db70413166d15d6d Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 15 Nov 2016 17:41:15 +0000 Subject: 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. --- platform/java/src/com/artifex/mupdf/fitz/Context.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'platform/java/src/com/artifex') 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. -- cgit v1.2.3