Antoine/Peter - thank you for your replies. I'm using Ant version 1.5.1.
I realise that is reasonably old. I've also noted that, with that version of Ant, I should be using IBM's BSF rather than Apache's. However, I cannot find an INM version of bsf.jar anywhere. Any links I have found, that report to have it, in fact do not. ** But regardless of that **, I do not seem to be getting as far as the bsf version issue. Ant is telling me it can't even find Script.class - but it's right there in optional.jar - which is in the lib folder! Is it perhaps the case that if the classloader cannot find a class that Script.class relies on (a BSF one say) then I will get the message I am seeing, i.e. that Script.class cannot be found (when in fact it can, but a class it references can't be found)? I need a solution that works on Ant version 1.5.1 and 1.6.1 (the same build scripts are run on machines with Ant 1.5.1 and on machines with Ant 1.6.1). Regards, Paul -----Original Message----- From: Antoine Levy-Lambert [mailto:[EMAIL PROTECTED] Sent: 24 April 2006 16:26 To: Ant Users List Subject: Re: Script task not found Which version of ant are you using ? optional.jar existed in ant up to ant 1.5.x. in ant 1.6.x, there is a file ant-apache-bsf.jar which contains the implementation on the ant side of scripting tasks and functionality. Also you normally do not need to taskdef script in ant 1.6.x and ant 1.5.x, it should be in the list of default tasks (Zip entry org.apache.tools.ant.taskdefs.default.properties in ant.jar) Regards, Antoine Paul Donaldson wrote: > Hello, > > I need to perform some simple arithmetic on the contents of a string. I have > read that the Script task is suitable for this purpose. > > I define my task as: > <taskdef name="script" > classname="org.apache.tools.ant.taskdefs.optional.Script"> > > But I keep getting the message: > file:build.xml:5: taskdef class > org.apache.tools.ant.taskdefs.optional.Script cannot be found > > I can see the class in optional.jar. optional.jar is in my ant lib folder. I > have tried adding a classpath attribute to the taskdef and setting it to the > ant lib folder, but with the same result. > > Does anyone know the reason for this? > > Not that it gets this far, but the target that uses the script task is > defined as: > > <target name="setup"> > > <script language="javascript"> <![CDATA[ > > for (i=1; i<=10; i++) { > echo = squares.createTask("echo"); > main.addTask(echo); > echo.setMessage(i*i); > } > > ]]> </script> > > </target> > > I am using Ant version 1.5.1 > I have downloaded and installed to ANT_HOME/lib: > js.jar version 1.6 R2 from www.mozilla.org/rhino/ > bsf.jar 2.3.0 from jakart.apache.org/bsf/ > > Many thanks, > Paul > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]