[izpack-users] 3.8.1: Custom Actions - Ant: Native dlls not available in java library path

René Krell rkrell at gk-software.com
Fri Jun 16 14:23:13 CEST 2006


I solved the problem by my own according to the recommendations at
http://openfacts.berlios.de/index-en.phtml?title=IzPack/UndocumentedFeatures:
---
Native libraries 
If you add some jar that used custom code, and use the <native> tag, don't use 
System.load or System.loadLibrary in order to load the native library. Use 
instead this: 
  Librarian.getInstance().loadLibrary(
	"myNativeLibWithoutExtension",
	nativeLibraryClient)
where: 
com.izforge.izpack.util.Librarian is a class supplied with IzPack. 
nativeLibraryClient is an object belonging to a class implementing the 
NativeLibraryClient interface. 
---

The problem was that System.loadLibrary does not work during custom Ant 
actions in own Ant tasks (due to a missing system property java.library.path 
or environment variable LD_LIBRARY_PATH).
The Librarian refers to a System.load which requires an absolute path to the 
native library instead.

Nevertheless, this is a workaround and in future it would be nice to have 
System.loadLibrary working for custom Ant actions in own Ant tasks, too, as 
long as the <native> tag is declared and the referred file is provided. At 
least there could be overgiven some system property java.library.path or so 
when calling Ant(?).
Otherwise I'd always have to add izpack jars to their classpath to use the 
Librarian and all depending classes.

René


On Tuesday 13 June 2006 15:32, René Krell wrote:
> On launching my self compiled installation jar, I get
> an "java.lang.UnsatisfiedLinkError: no win32jni in java.library.path" (see:
> stacktrace.log) when launching a custom Ant install action, even though I
> declared the appropriate DLL in my install.xml:
>
>   <native type="3rdparty" name="win32jni.dll"/>
>
> Questions:
> 1. Is it possible to use links to native libraries from custom Ant actions
> at all?
> 2a. Where is the right place to declare them (if I need them only at
> install time)?
> 3b. or ... How can I set the according properties probably needed for this
> and given to the Ant launcher as -Djava.library.path (and user variables,
> as LD_LIBRARY_PATH)? Are they set automatically by the installer?
>
> Thanks,
> René



More information about the izpack-users mailing list