3
$\begingroup$

I'm using Ant script in Eclipse using Workbench on Windows 7. I've used multiple versions but the issue persists. Essentially, I define multiple targets and call them in sequence like this:

Multiple targets (# below is 1, 2, etc.):

<target name="target-#">
  <mathematica exe="${mathExe}"
    ...mathematica operations
  </mathematica>
</target>

Calling targets:

<target name="callingTarget">
  <antcall targe="target-1">
  <antcall targe="target-2">
</target>

Individual target can all run smoothly. But if called in sequence, the second one would fail with this message:

[mathematica] Fatal error: cannot find the required native library named JLinkNativeLibrary.

Searching of this error points to CLASSPATH, which I tried various ways including hard coding in the Ant script and setting in Environment.

However, it would work fine when using "depends":

<target name="callingTarget" depends="target-1,target-2">
</target>

I guess it has something to do with how Mathematica workbench loads/resets JLink. A further twist is that if the above "target-1" is docbuild (target "main" in docbuild.xml) provided by Workbench, even "depends" gives the same error when "target-2" starts.

I echo'ed "\${mathExe}" and "${jlinkpath}" in each target and they were still defined correctly. I'd appreciate your help or suggestion on where the loading issues might be.

$\endgroup$
2
$\begingroup$

I just found a solution for it: adding the JLink.jar to Ant Runtime (Windows/Preference/Ant/Runtime/Classpath/Add External JARs).

Previously I tried Windows environment %path% but did not work. It probably could work with some other settings since this is also addressing the CLASSPATH issue.

It has been bothering me for quite some time but I can't get around it any more. I'm not sure what really is going on but maybe future Workbench will fix this.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.