public final class LibraryLoader extends 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 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
(构建DLL名称时附加到“ jacob”。此字符串必须与build.xml文件中的字符串完全匹配)
|
static 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
(构建DLL名称时附加到“ jacob”。此字符串必须与build.xml文件中的字符串完全匹配)
|
static 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').
(系统属性的名称(当前为jacob.dll.name),其中可能包含JNI库的备用名称(默认为'jacob')。)
|
static 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.
(系统属性的名称(当前为jacob.dll.name),其中可能包含JNI库的备用名称(默认为'jacob'),64位窗口。)
|
static 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.
(系统属性的名称(当前为jacob.dll.name),其中可能包含JNI库的备用名称(默认为'jacob'),32位窗口。)
|
static String |
JACOB_DLL_PATH
Name of system property (currently
jacob.dll.path) that may contain an absolute path to the JNI library.
(系统属性的名称(当前为jacob.dll.path),其中可能包含JNI库的绝对路径。)
|
Constructor and Description |
---|
LibraryLoader() |
Modifier and Type | Method and Description |
---|---|
static String |
getPreferredDLLName()
Developer note: This method MUST be synchronized with the DLL names created as part of the build process in build.xml
(开发人员说明:此方法必须与在build.xml中作为生成过程的一部分创建的DLL名称同步。)
|
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.
(从绝对路径或通过库名加载jacob dll,这两种定义都可以通过各种方式进行。)
|
protected static boolean |
shouldLoad32Bit()
Detects whether this is a 32-bit JVM.
(检测这是否是32位JVM。)
|
public static final String JACOB_DLL_PATH
public static final String JACOB_DLL_NAME
public static final String JACOB_DLL_NAME_X86
public static final String JACOB_DLL_NAME_X64
public static final String DLL_NAME_MODIFIER_32_BIT
public static final String DLL_NAME_MODIFIER_64_BIT
public static void loadJacobLibrary()
UnsatisfiedLinkError
- if the library does not exist.
public static String getPreferredDLLName()
The DLL name is "jacob\
protected static boolean shouldLoad32Bit()
true
if this is a 32-bit JVM.
(如果是32位JVM。)
http://jacob-project.sourceforge.net