Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Best means to create a Windows cmd file from ant

Best means to create a Windows cmd file from ant

2004-02-04       - By coluf
Reply:     1     2     3     4  

I wish to create a script file for Windows, that is, a .cmd file to start my
java project.  

It makes sense to create the file from within ant so any changes to the class
path are reflected in the script.

But what is the best way to create a Windows script file from within ant?
Using <echo> does not terminate the end-of-lines
for Windows correctly (must default for unix?).

An extract from my ant script...

  <target name="dist" depends="init, jar">
     ...
     <pathconvert targetos="windows" property="dist.libs" refid="build
.classpath"/>
     <echo file="${dist.bin}/${corename}.cmd">@(protected) off
        setlocal
        set classpath=${jar.filename};${dist.libs}
        java ${main.class} -cp %classpath%
     </echo>


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.