You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Thomas Saxtoft <TS...@sondagsavisen.dk> on 2004/11/15 14:41:23 UTC

Escapign backslash in java.home

On a Windows XP I have to write the java.home property to a file, but
doing that the '\' disappears. I suspect that it needs to be escaped
like '\\', but the value of java.home is the one that contains the
backslash.
How do I write it to the file?

The next thing is, how do I make it general so that it also works on a
Linux machine?

Thanks in advance,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Escapign backslash in java.home

Posted by Peter Reilly <pe...@apache.org>.
What is wrong with the following?
  <target name="h">
    <concat destfile="x.txt">
      java.home is ${java.home}
    </concat>
  </target>

If you wanted to replace \ with \\, you could use a scriptfilter:
    <concat destfile="x.txt">
      <filterchain>
        <scriptfilter language="beanshell">
          self.setToken(self.getToken().replace("\\", "\\\\"));
        </scriptfilter>
      </filterchain>
      \a\b\c
    </concat>

Peter

Thomas Saxtoft wrote:

>On a Windows XP I have to write the java.home property to a file, but
>doing that the '\' disappears. I suspect that it needs to be escaped
>like '\\', but the value of java.home is the one that contains the
>backslash.
>How do I write it to the file?
>
>The next thing is, how do I make it general so that it also works on a
>Linux machine?
>
>Thanks in advance,
>
>Thomas
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org