ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Saxtoft" ...@sondagsavisen.dk>
Subject RE: Escapign backslash in java.home
Date Tue, 16 Nov 2004 09:10:38 GMT
The thing is that the java.home I get from ant already contains the
backslash.

My script looks like this:
<target name="createServerXml">
    <replaceregexp file="${oc4j_home}/config/server.xml"
    match="&lt;java-compiler [^>]*/>"
    replace="&lt;java-compiler bindir=&quot;${java.home}/bin&quot;
extdirs=&quot;${java.home}/jre/lib/ext&quot;/>"/>
  </target>

I need to change the backslash contained in the property (java.home) to
a frontslash, before writing to the file. When written to the file the
backslash has disappeared, and thus it is too late to replace it.

By using ${java.home} the idea is always to get the correct path to jdk,
on either OS; Windows or Linux.

Thanx

Thomas


-----Original Message-----
From: Conelly, Luis (GE Energy, Non GE, GENE)
[mailto:Luis1.Conelly@ge.com] 
Sent: Monday, November 15, 2004 3:24 PM
To: Ant Users List
Subject: RE: Escapign backslash in java.home

why don't you use forward-slashes instead backslashes?

It is the same for Java and it fits on Win & *nix systems; of course, it
won't work the same on any OS, since in Win you have this horrible
drives concept (C: D: etc)

i.e 

(for Win)
java.home=C:/j2se1.4.2/bin

(for *nix)
java.home=/usr/local/java/1.4.2/bin


bottom line, you have to write properties for both OSes and pick them on
the fly by using something like <condition> [1] task. This kind of
operation has been discused in this list several times [2]

Hope this helps
Regards
Luis

[1] http://ant.apache.org/manual/CoreTasks/condition.html
[2] http://marc.theaimsgroup.com/?l=ant-user&m=109760252905015&w=2
    http://marc.theaimsgroup.com/?l=ant-user&m=107631038006160&w=2

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


Mime
View raw message