summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-01-17 21:31:31 +0100
committerTor Andersson <tor.andersson@artifex.com>2017-01-17 23:16:31 +0100
commit9d7b84782f3ac699961f014292c50bdc971760d3 (patch)
tree5015a3a27c00d7b4a382ab14940ea9d9716c58b9
parentaac6fa48f1f44a70f172d74505267b89d30f9a7d (diff)
downloadmupdf-9d7b84782f3ac699961f014292c50bdc971760d3.tar.xz
java: Simplify loadLibrary call.
Always look in order for the following libraries: mupdf_java64 mupdf_java32 mupdf_java
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/Context.java36
1 files changed, 9 insertions, 27 deletions
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Context.java b/platform/java/src/com/artifex/mupdf/fitz/Context.java
index 60de22e6..7734a274 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/Context.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/Context.java
@@ -15,38 +15,20 @@ public class Context
public static void init() {
if (!inited) {
inited = true;
- System.loadLibrary(getLibraryName());
+ try {
+ System.loadLibrary("mupdf_java64");
+ } catch (UnsatisfiedLinkError e) {
+ try {
+ System.loadLibrary("mupdf_java32");
+ } catch (UnsatisfiedLinkError ee) {
+ System.loadLibrary("mupdf_java");
+ }
+ }
if (initNative() < 0)
throw new RuntimeException("cannot initialize mupdf library");
}
}
- 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");
- /* Android does NOT support this, and returns NULL */
- if (val != null && val.equals("64")) {
- 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(); }
// FIXME: We should support the store size being changed dynamically.