ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinar Bicioglu <p.bicio...@CustomerDialogue.com>
Subject RE: FW: Can't find the files
Date Fri, 06 Apr 2001 17:41:55 GMT
This helped a lot. Actually my problem has been solved. I want to thank you
all so much!!

Everything is working fine now. But I have a question about setting them as
an enviroment variables. How do we do that ? And can we solve this problem
without involving user work in it. Do they have to make changes with every
way ?

Thanks again!

-----Original Message-----
From: Diane Holt [mailto:holtdl@yahoo.com]
Sent: Friday, April 06, 2001 1:21 PM
To: ant-user@jakarta.apache.org
Subject: RE: FW: Can't find the files


Hi Pinar,

The idea of using a property to specify the path up to the point where the
JDK's subdir structure kicks in is to allow the build to work without
requiring that everyone has the JDKs in the same place -- it's what the
"jdk118root" and "jdk122root" properties are for. For example, on your
machine, they live in d:/jdk1.1.8 and d:/jdk1.2.2, but on someone else's
machine they could live in, say, z:/java, or /usr/local/tools, etc. So,
what you want is to have the build.xml file reference ${jdk118root} and
${jdk122root}, rather than hard-coding in those locations. Then -- and
this is the part where you need to decide how you want things to work in
your specific process -- the values for ${jdk118root} and ${jdk122root}
need to be defined when 'ant' is run. You can do that by saying people are
required to have a properties file in their home directory that defines
them, or you can define them on the command line (like I showed you
earlier), or you can have them set as environment variables, etc. It's not
possible to tell you exactly how to do this part -- it's really up to how
you want to set things up.  That's why I told you to just define them on
the command line at first so you can get the hang of how it's going to
work -- it's not the way I'd recommend you actually implement things.

Let's say that you decide you want to require that users have a properties
file in their home directory, called "ant.properties", which defines where
the JDKs live on their machine -- for example, your ant.properties would
contain:
jdk118root=d:/jdk1.1.8
jdk122root=d:/jdk1.2.2

whereas mine would contain, say:
jdk118root=/usr/local/tools/java/jdk118
jdk122root=/usr/local/tools/java/jdk122

Then, in your build.xml file, you would read in that file, *before* you
reference the ${jdk118root} and ${jdk122root} properties, using:
<property file="${user.home}/ant.properties"/>

That gets ${jdk118root} and ${jdk122root} defined, and with the values
specific for the user.

Then, in your build.xml file you would set the paths to the JDK classes,
being sure to *reference* the ${jdk118root} and ${jdk122root} properties:
<property name="Java122Classes" value="${jdk122root}"/jre/lib/rt.jar"/>
<property name="Java118Classes" value="${jdk118root}"/lib/classes.zip"/>

Or, you could put those property definitions in a properties file:
Java122Classes=${jdk122root}/jre/lib/rt.jar
Java118Classes=${jdk118root}/lib/classes.zip

and read that file in as well (in this example, called "build.properties",
and living in the same directory as your build.xml file:
<property file="build.properties"/>

but you *wouldn't* both set the individual properties in build.xml and
read in a properties file that defines them -- choose the method that you
prefer.

Now, when you run 'ant' the full-path to your 1.2.2 rt.jar file will
become d:/jdk1.2.2/jre/lib/rt.jar -- but when I run 'ant', the full-path
to the jar will become /usr/local/tools/java/jdk122/jre/lib/rt.jar.

Hope this helps,
Diane

--- Pinar Bicioglu <p.bicioglu@CustomerDialogue.com> wrote:
> Just for trying, since my JDKs live in D drive in my machine, I wrote
> 
> <property name="$Java122Classes" value="d:/jdk1.2.2/jre/lib/rt.jar" />
> <property name="Java118Classes" value="d:/jdk1.1.8/lib/classes.zip" />
> 
> in my "build.properties" file. After deleting
> 
> <property name= " Java122Classes" value="/jdk122/jre/lib/rt.jar" />
> <property name= " Java118Classes" value="/jdk118/jre/lib/classes.zip" />
> 
> lines from build.xml file, I wrote 
> 
> <property file="build.properties" /> on the top of build.xml file. 
> 
> So it's suppose to go and find files and work correctly right? but it's
> not
> working and I don't know what I am doing wrong here :(
> 
> 
> -----Original Message-----
> From: Diane Holt [mailto:holtdl@yahoo.com]
> Sent: Friday, April 06, 2001 11:59 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: FW: Can't find the files
> 
> 
> --- Pinar Bicioglu <p.bicioglu@CustomerDialogue.com> wrote:
> > :) Not really. I have been still working on that. I made a properties
> > file containing 
> > 
> > <property name="Java122Classes"
> > value="${jdk122root}/jdk1.2.2/jre/lib/rt.jar" />\
> > <property name="Java118Classes"
> > value="${jdk118root}/jdk1.1.8/lib/classes.zip" />
> > 
> > then I added the <properties name="build.properties"/> line on the top
> > of my build.xml file. But it still not working. I also tried Nico's
> and
> > Anuj's suggestions but no result!! I think I am messing something up
> > here!
> 
> You would read in a properties file called build.properties using the
> file
> attribute, not the name attribute:
> 
>   <property file="build.properties"/>
> 
> You also need to set the "jdk122root" and "jdk118root" properties to the
> appropriate path. For example, if the JDK jars on your machine live in,
> say, d:/java/tools, then you need to get the "jdk122root" and
> "jdk118root"
> properties set to that before you run 'ant'. You can do that in a number
> of different ways, and the way you choose depends on how you've designed
> your build process. For now, just to get things working so you can at
> least get past this hump, try just defining it on the 'ant' command
> line:
> 
> C:\> ant -Djdk122root=d:/java/tools -Djdk118root=d:/java/tools
> 
> substituting "d:/java/tools" for the actual path of where your two JDKs
> live on your machine.
> 
> Diane 
> 
> =====
> (holtdl@yahoo.com)
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail. 
> http://personal.mail.yahoo.com/


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Mime
View raw message