> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Troy Laurin
> Sent: donderdag 14 juli 2005 11:59
> To: Shelly Midha
> Cc: nant-users@lists.sourceforge.net
> Subject: Re: [Nant-users] Error while compiling java file 
> using javac in NAnt script?
> 
> On 7/14/05, Shelly Midha <[EMAIL PROTECTED]> wrote:
> >  
> >   
> > I'm compiling a set of java files using the following 
> command in NAnt file 
> >   
> > <exec program="javac"  commandline = "-classpath 
> %CLASSPATH% ${filename}"
> > failonerror = "false">
> > </exec> 
> 
> Shelly,
> 
> The %CLASSPATH% environment variable is probably not being expanded -
> this is usually done by the command processor (cmd) but you are
> executing javac directly...
> 
> If you are using NAnt 0.85, you can get the value of the environment
> variable using ${environment::get-variable('CLASSPATH')}, but you may
> need to wrap it in an existence check
> ${environment::variable-exists('CLASSPATH')}, and there may be issues
> with case sensitivity (!)...
> http://nant.sourceforge.net/release/latest/help/functions/#Environment
> for more details.
> 
> 
> Alternatively, run your exec through cmd.exe...
> 
> <exec program="cmd" commandline="javac -classpath %CLASSPATH% ..."
> failonerror="false" />

If you're using NAnt 0.85, another solution would be this:

        <exec program="javac">
                <arg value="-classpath" />
                <arg path="%CLASSPATH%" />
                <arg file="${filename}" />
        </exec>

Gert



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to