Maybe this will save someone an hour... to set java.library.path from inside an ANT Java task, you need to set the parameter fork="true".

    <target name="run" depends="deploy">
       <java dir="${jlan}" classname="" fork="true">
         <arg value="${jlan}/jlanConfig.xml"/>
         <sysproperty key="java.library.path" path="${jlan}/jni"/>
            <filelist dir="${jlan}">
                <file name="jars/alfresco-jlan.jar" />
                <file name="libs/cryptix-jce-provider.jar" />
                <file name="service/wrapper.jar" />
                <file name="libs/bullhorn-virtualfs-0.1.jar" />
                <file name="libs/log4j-1.2.14.jar" />

The reason seems to be that ANT does not allow you to reset a property. Once it's set, that's it. Of course, the ant task has its own java.library.path already, so manually setting it will be ignored. The fork is kind of a hack, by forcing a new process, you get clean system variables.

Tags: ,