diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-02-22 15:00:29 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-02-29 16:03:34 +0100 |
commit | 7609158e702ece6e182b19cec8b0192b1af598e8 (patch) | |
tree | d6611bc8243a457b2fe90bfebd72454e93601288 /platform/java/com/artifex/mupdf/fitz/Context.java | |
parent | e1716629fd92f4580e6b213dc7be54b4935f09f9 (diff) | |
download | mupdf-7609158e702ece6e182b19cec8b0192b1af598e8.tar.xz |
jni: Various cleanups.
jni: Various cleanups.
Fix gcc and clang warnings.
Android specific functions are guarded by HAVE_ANDROID define.
The java guts of the android stuff is removed for now, to be added back in later.
Set up a makefile and simple tests to build for desktop java.
Rerig device classes to: Device, NativeDevice, JavaDevice and DrawDevice.
Add Pixmap class.
Regularize naming.
General cleanups and abbreviate naming.
Use to_JavaClass and from_JavaClass rather than
fz_mupdf_struct_from_JavaClass and JavaClass_from_fz_mupdf_struct.
Check for exceptions thrown by java devices and path processor.
Tweak constructors and finalizers to remove the JavaDevice subclass.
Use toString when rethrowing java exceptions as fitz exceptions.
Diffstat (limited to 'platform/java/com/artifex/mupdf/fitz/Context.java')
-rw-r--r-- | platform/java/com/artifex/mupdf/fitz/Context.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/platform/java/com/artifex/mupdf/fitz/Context.java b/platform/java/com/artifex/mupdf/fitz/Context.java index 1baafb01..3614e65f 100644 --- a/platform/java/com/artifex/mupdf/fitz/Context.java +++ b/platform/java/com/artifex/mupdf/fitz/Context.java @@ -8,12 +8,20 @@ package com.artifex.mupdf.fitz; // function. public class Context { - // Load our native library - static - { - System.loadLibrary("mupdf"); + private static boolean inited = false; + private static native int initNative(); + + public static void init() { + if (!inited) { + inited = true; + System.loadLibrary("mupdf_java"); + if (initNative() < 0) + throw new RuntimeException("cannot initialize mupdf library"); + } } + static { init(); } + // FIXME: We should support the store size being changed dynamically. // This requires changes within the MuPDF core. //public native static void setStoreSize(long newSize); |