I am trying to copy Demo.jar file (generated by an ant task) on my desktop(or any directory specified by it’s absolute path on my XP machine).
I am specifying absolute path in a properties file and reading it on the fly.
The problem is I am not able to read this absolute path properly, where I want my Demo.jar to be copied.
Absolute path given in properties file is :-
“C:\Documents and Settings\Administrator\Desktop\google\my java”
and script is echoing :-
[echo] C:Documents and SettingsAdministratorDesktopgooglemy java
Below is my edited version of build.xml and antParams.properties:-
build.xml
<project default="copy">
<property file="antParams.properties" prefix="antParams"/>
<target name="jar" >
<jar destfile="${antParams.jarName}"
basedir="${antParams.binDir}"
includes="**/*.class"
/>
</target>
<target name="copy" depends="jar">
<echo>${antParams.jarDestination}</echo>
<!-- what goes here -->
</target>
</project>
antParams.properties
jarName=Demo.jar
binDir=bin
jarDestination=C:\Documents and Settings\Administrator\Desktop\
Thanx in advance…. 🙂
Use double backslashes (c:\\Doc …), or better yet, use forward slash (c:/Doc …). Ant knows how to use forward slash in a cross-platform way, it converts it correctly to backslashes on windows.