SF1493647 support alternate dll loading directories
This commit is contained in:
@@ -107,15 +107,15 @@
|
||||
<echo>Building java classes in ${java.bin}...</echo>
|
||||
<javac srcdir="${java.src}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
listfiles="true" debug="on" source="1.4" />
|
||||
<echo>Building java sample classes ...</echo>
|
||||
<javac srcdir="${java.samples}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
listfiles="true" debug="on" source="1.4" />
|
||||
<echo>Building java test classes...</echo>
|
||||
<javac srcdir="${java.unittest}"
|
||||
destdir="${java.bin}"
|
||||
listfiles="true" debug="on" fork="yes" />
|
||||
listfiles="true" debug="on" source="1.4" />
|
||||
</target>
|
||||
<!-- ======================================================================
|
||||
Package the classes into a JAR.
|
||||
|
||||
@@ -31,6 +31,13 @@
|
||||
<tr>
|
||||
<td width="100%" colspan="2"><b>Patches</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%">SF1493647</td>
|
||||
<td width="87%">Support command line parameter dll location specification.
|
||||
Applets and other tools can now specificy the dll location that
|
||||
is fed to a System.load() rather than System.loadLibrary for the
|
||||
situation where the app can't write the dll to a library path directory.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%"> </td>
|
||||
<td width="87%"> </td>
|
||||
|
||||
@@ -149,6 +149,6 @@ public abstract class ComThread {
|
||||
* any other reference to one of the JacboObject subclasses is made.
|
||||
*/
|
||||
static {
|
||||
JacobObject.loadJacobLibrary();
|
||||
LibraryLoader.loadJacobLibrary();
|
||||
}
|
||||
}
|
||||
@@ -62,15 +62,6 @@ public class JacobObject {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* loads the jacob library dll
|
||||
*
|
||||
*/
|
||||
protected static void loadJacobLibrary(){
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads version information from version.properties that was
|
||||
* built as part of this release.
|
||||
@@ -156,7 +147,7 @@ public class JacobObject {
|
||||
* force the jacob DLL to be loaded whenever this class is referenced
|
||||
*/
|
||||
static {
|
||||
JacobObject.loadJacobLibrary();
|
||||
LibraryLoader.loadJacobLibrary();
|
||||
}
|
||||
|
||||
|
||||
|
||||
56
src/com/jacob/com/LibraryLoader.java
Normal file
56
src/com/jacob/com/LibraryLoader.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2004 Sourceforge JACOB Project.
|
||||
* All rights reserved. Originator: Dan Adler (http://danadler.com).
|
||||
* Get more information about JACOB at http://sourceforge.net/projects/jacob-project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.jacob.com;
|
||||
|
||||
/**
|
||||
* Utility class to centralize the way in which the jacob JNI library is loaded.
|
||||
*
|
||||
* <p>If system property {@link #JACOB_DLL_PATH} is defined, the file located there
|
||||
* will be loaded as the jacob dll. If the system property is not defined, normal
|
||||
* library paths will be used to load the jacob dll. This means it defaults to the
|
||||
* previous behavior for existing applications.
|
||||
* <p>
|
||||
* Submitted sourceforge ticket 1493647
|
||||
* @author Scott Dickerson (sjd78)
|
||||
*/
|
||||
public final class LibraryLoader {
|
||||
/**
|
||||
* Name of system property (currently <tt>jacob.dll.path</tt>) that may contain
|
||||
* an absolute path to the JNI library.
|
||||
*/
|
||||
public static final String JACOB_DLL_PATH = "jacob.dll.path";
|
||||
|
||||
|
||||
/**
|
||||
* Load the jacob dll either from an absolute path defined in system property
|
||||
* {@link #JACOB_DLL_PATH} or as a general library called "<tt>jacob</tt>".
|
||||
*/
|
||||
public static void loadJacobLibrary() {
|
||||
String path = System.getProperty(JACOB_DLL_PATH);
|
||||
if (path != null) {
|
||||
System.load(path);
|
||||
}
|
||||
else {
|
||||
System.loadLibrary("jacob");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // LibraryLoader
|
||||
@@ -222,7 +222,7 @@ public abstract class ROT {
|
||||
* so we force a DLL load here by referncing JacobObject
|
||||
*/
|
||||
static {
|
||||
JacobObject.loadJacobLibrary();
|
||||
LibraryLoader.loadJacobLibrary();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,6 +93,6 @@ public class STA extends Thread {
|
||||
* the DLL without this
|
||||
*/
|
||||
static {
|
||||
JacobObject.loadJacobLibrary();
|
||||
LibraryLoader.loadJacobLibrary();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user