public final class LibraryLoader
extends java.lang.Object
This supports defining the path or library name using system properties or a custom resource file. If desired, jacob can auto-detect the correct version of the DLL for 32 or 64 bit windows, as long as you have named them differently.
JACOB_DLL_PATH
is defined, the file located
there will be loaded as the jacob dll using System.load(). JACOB_DLL_NAME
is defined, the file located
there will be loaded as the jacob dll. JACOB_DLL_NAME_X86
and
JACOB_DLL_NAME_X64
are defined, the file located there will be
loaded as the jacob dll, depending on the version of Windows. JACOB_DLL_NAME
is defined in the
com.jacob.com.JacobLibraryLoader
resource file, the specified dll
will be loaded from the java.library.path
. JACOB_DLL_NAME_X86
and JACOB_DLL_NAME_X64
are
defined in the com.jacob.com.JacobLibraryLoader
resource file, the
specified dll will be loaded from the java.library.path
, depending
on the version of Windows. java.library.path
.
LoadLibrary()
will be called to load the dll. LoadLibary()
searches directories
specified in the variable java.library.path
. This is why most test
cases specify -Djava.library.path in their command line arguments.
JACOB_DLL_PATH submitted sourceforge ticket 1493647 Added 1.11
JACOB_DLL_NAME, JACOB_DLL_NAME_32, JACOB_DLL_NAME_64 submitted sourceforge
ticket 1845039 Added 1.14M7
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DLL_NAME_MODIFIER_32_BIT
Appended to "jacob" when building DLL name This string must EXACTLY match
the string in the build.xml file
|
static java.lang.String |
DLL_NAME_MODIFIER_64_BIT
Appended to "jacob" when building DLL name This string must EXACTLY match
the string in the build.xml file
|
static java.lang.String |
JACOB_DLL_NAME
Name of system property (currently jacob.dll.name) that may
contain an alternate name for the JNI library (default is 'jacob').
|
static java.lang.String |
JACOB_DLL_NAME_X64
Name of system property (currently jacob.dll.name) that may
contain an alternate name for the JNI library (default is 'jacob'), 64
bit windows.
|
static java.lang.String |
JACOB_DLL_NAME_X86
Name of system property (currently jacob.dll.name) that may
contain an alternate name for the JNI library (default is 'jacob'), 32
bit windows.
|
static java.lang.String |
JACOB_DLL_PATH
Name of system property (currently jacob.dll.path) that may
contain an absolute path to the JNI library.
|
Constructor and Description |
---|
LibraryLoader() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getPreferredDLLName()
Developer note: This method MUST be synchronized with the DLL names
created as part of the build process in build.xml
|
static void |
loadJacobLibrary()
Load the jacob dll either from an absolute path or by a library name,
both of which may be defined in various ways.
|
protected static boolean |
shouldLoad32Bit()
Detects whether this is a 32-bit JVM.
|
public static final java.lang.String JACOB_DLL_PATH
public static final java.lang.String JACOB_DLL_NAME
public static final java.lang.String JACOB_DLL_NAME_X86
public static final java.lang.String JACOB_DLL_NAME_X64
public static final java.lang.String DLL_NAME_MODIFIER_32_BIT
public static final java.lang.String DLL_NAME_MODIFIER_64_BIT
public static void loadJacobLibrary()
java.lang.UnsatisfiedLinkError
- if the library does not exist.public static java.lang.String getPreferredDLLName()
The DLL name is "jacob\
protected static boolean shouldLoad32Bit()
true
if this is a 32-bit JVM.http://jacob-project.sourceforge.net