MathematicaTask.java
- To: mathgroup at smc.vnet.net
- Subject: [mg69584] MathematicaTask.java
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sat, 16 Sep 2006 03:50:24 -0400 (EDT)
Hi, I am trying to use the ant task that ships with Mathematica. When I use the Java Runtime Environment that ships with Mathematica, the build succeeds. However, this is not something I want to depend upon, because my real build is meant to do other things in addition to running Mathematica code: C:\Documents and Settings\Chris\Desktop>"C:\Program Files\ant\apache-ant-1.6.5\b in\ant.bat" Buildfile: build.xml all: [echo] 0 [echo] 1 [echo] 4 [echo] 9 [echo] 16 [echo] 25 [echo] 36 [echo] 49 [echo] 64 [echo] 81 BUILD SUCCESSFUL Total time: 1 second When I use Sun's standard jre1.5.0_06 (aka Java 5), the build fails with a lot of errors: C:\Documents and Settings\Chris\Desktop>"C:\Program Files\ant\apache-ant-1.6.5\b in\ant.bat" Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.5. 0_06\lib\tools.jar Buildfile: build.xml all: [mathematica] Fatal error: cannot find the required native library named JLinkNa tiveLibrary. BUILD FAILED java.lang.UnsatisfiedLinkError: MLOpen Total time: 1 second The output doesn't show it, but a dialog box also pops up saying it can't find jawt.dll. Here is the source code for the build: <?xml version="1.0" encoding="UTF-8"?> <project name="Website Build" default="all"> <property environment="env"/> <taskdef name="mathematica" classname="com.wolfram.jlink.util.MathematicaTask" classpath="C:\Program Files\Wolfram Research\Mathematica\5.2\AddOns\JLink\JLink.jar"/> <target name="all"> <mathematica exe="C:\Program Files\Wolfram Research\Mathematica\5.2\MathKernel"> <![CDATA[ For[i=0,i<10,i++,echo=Ant["project"]@createTask["echo"];echo@setMessage[ToString[i^2]];echo@perform[]] ]]> </mathematica> </target> </project> If you will, please tell me how I can use the MathematicaTask (look for MathematicaTask.java inside the Mathematica distribution) with a standard Java Runtime Environment. (I recommend testing with the version that doesn't work first. The version that does work appears to be "sticky" (on Windows anyway) - and no, I don't know how to be more definite than that.) -- http://chris.chiasson.name/