Look up the 'loaderef' attribute of <taskdef> in the doc. Also consider creating a properties file that defines all your tasks in one fell swoop, within the same classloader.
--- com/xhive/anttasks/tasks.properties --- createlibrary = com.xhive.anttasks.CreateLibrary parse = com.xhive.anttasks.Parse ... Package that properties file within your JAR. Then import it --- build.xml --- <target name="load-taskdefs" depends="init"> <taskdef resource="com/xhive/anttasks/tasks.properties" classpathref="classpath" /> </target> You may also want to create a datatype for your common attributes bootstrap/database/user/password. You'll then need again to use loaderef so that the taskdef and typedef can share the same classloader. --DD -----Original Message----- From: Jeroen Breedveld [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 6:58 AM To: [EMAIL PROTECTED] Subject: Custom anttask classloader problem Hi all, I created custom anttasks to perform common tasks on a database. The database has a java interface but the kernel is written in C++ so JNI is used to call functions in a windows DLL. The problem I have is that when more than 1 of those custom anttasks are used in 1 target I get the following error: java.lang.UnsatisfiedLinkError: Native Library C:\objy71\bin\oojava.dll already loaded in another classloader This probably means that different classloaders are used for every anttask. Is this true? Is there a around this problem? Is there a way to use the same classloader for every anttask? The only solution I have come up with myself is putting every needed jar in ANT_HOME/lib but this is not an elegant solution. Here is a piece from my build file for clarity: <target name="load-taskdefs" depends="init"> <taskdef name="createlibrary" classname="com.xhive.anttasks.CreateLibrary" classpathref="classpath"/> <taskdef name="parse" classname="com.xhive.anttasks.Parse" classpathref="classpath"/> <taskdef name="exportlibrary" classname="com.xhive.anttasks.ExportLibrary" classpathref="classpath"/> <taskdef name="elementindex" classname="com.xhive.anttasks.indextasks.ElementIndex" classpathref="classpath"/> <taskdef name="libraryIdIndex" classname="com.xhive.anttasks.indextasks.LibraryIdIndex" classpathref="classpath"/> <taskdef name="valueindex" classname="com.xhive.anttasks.indextasks.ValueIndex" classpathref="classpath"/> <taskdef name="deleteindex" classname="com.xhive.anttasks.indextasks.DeleteIndex" classpathref="classpath"/> <taskdef name="fulltextindex" classname="com.xhive.anttasks.indextasks.FullTextIndex" classpathref="classpath"/> </target> <target name="load-forms" depends="load-taskdefs"> <createlibrary bootstrap="${bootstrap}" database="${database}" user="${user}" password="${password}" name="forms" silent="true"/> <parse bootstrap="${bootstrap}" database="${database}" user="${user}" password="${password}" parent="/forms" namequery="namespace xhive = 'http://www.x-hive.com' //xhive:id/@xhive:name" newer="true"> <fileset dir="../data/forms"> <include name="**/*"/> </fileset> </parse> </target> thanks, Jeroen Breedveld -- X-Hive Corporation e-mail: [EMAIL PROTECTED] phone: +31 10 7108622 http://www.x-hive.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>