Java – Netbeans 6.5: Change an environment variable during run/debug/test


Up until Netbeans 6.1, I was using the following recipe to change the PATH environment variable during run/debug/test tasks: in the build.xml file I included:

<property environment="env"/>
<target name="-init-macrodef-java">
   <macrodef name="java" uri="">
       <attribute default="${main.class}" name="classname"/>
       <element name="customize" optional="true"/>
           <java classname="@{classname}" dir="${work.dir}" fork="true">
               <jvmarg line="${run.jvmargs}"/>
               <env key="Path" path="${work.dir}/../../bin;${env.Path}">                              

(this was for Windows machines). Under Netbeans 6.5, this magic no longer seems to work, not for PATH, or other environment variables (using key="…" value="…" instead). I rebuild the NB projects from scratch to little avail, and I am no Ant expert to begin with. Any pointers/suggestions?

Best Solution

Try using

 <env key="PATH" path="..."/>

instead of

 <env key="Path"  path="..."/>

it is case insensitive only on Windows and ant > 1.7