You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Hannes van der Merwe <Ha...@meb.co.za> on 2001/12/06 12:17:44 UTC

Check for environment variable existence

In my build script I setup a property with a specific classpath. Now if the
environment variable: "CLASSPATH", is set before hand I need to include this
existing classpath into the specific classpath setup in the build script.

What is the best way to check if the environment variable: "CLASSPATH" is
set or not?

Hannes van der Merwe
Momentum Employment Benefits (IT)
Telephone : (011) 685 4306
Fax : (011) 685 4006
Email : hannesv@meb.co.za

E-mail disclaimer

Confidentiality Warning
=======================
The contents of this message and any attachments are intended solely for the
addressee's use and may be legally privileged and/or confidential. If you
are not the addressee indicated in this message, any retention,
distribution, copying or use of this message is strictly prohibited. If you
received this message in error, kindly notify the sender immediately by
reply e-mail and then destroy the message and any copies thereof. The
content and any views expressed therein are, unless otherwise stated, the
views of the author and not those of the company or any of its management or
directors. 
Whilst all reasonable steps are taken to ensure the accuracy and integrity
of information transmitted, the company does not accept responsibility for
any corruption of the information or data or breach of confidentiality as a
result of electronic submission.
When addressed to the Momentum Employee Benefits clients any opinion or
advice contained in this e-mail is subject to the terms and conditions
expressed in any applicable terms of business.


Re: Check for environment variable existence

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 6 Dec 2001, Hannes van der Merwe <Ha...@meb.co.za> wrote:

> What is the best way to check if the environment variable:
> "CLASSPATH" is set or not?

<property environment="env" />

now either env.CLASSPATH exists or it doesn't and you can use
if/unless attributes based on it.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Check for environment variable existence

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
And tools.jar as well, which is not in ANT_HOME/lib, of course.  Yup, I knew
that and should have noted that too when I mentioned it.


----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <an...@jakarta.apache.org>
Sent: Thursday, December 06, 2001 7:11 AM
Subject: Re: Check for environment variable existence


> On Thu, 6 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
> wrote:
>
> > Ant provides system properties to you, and you will have
> > ${java.class.path} available already if needed.
>
> But this will contain classes that are not in the CLASSPATH
> environment (all stuff from ANT_HOME/lib).
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Check for environment variable existence

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 6 Dec 2001, Erik Hatcher <ja...@ehatchersolutions.com>
wrote:

> Ant provides system properties to you, and you will have
> ${java.class.path} available already if needed.

But this will contain classes that are not in the CLASSPATH
environment (all stuff from ANT_HOME/lib).

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Check for environment variable existence

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
Also, keep in mind that when running Ant through the wrapper scripts that
your environment classpath is already available and used by Ant and all
tasks that it runs in its own VM.

Perhaps you should discuss more about what you are planning on doing with
the CLASSPATH from the environment, because its very unusual that you'd need
access to it directly and there is likely to be a more recommended way of
doing what you're trying to do.

Ant provides system properties to you, and you will have ${java.class.path}
available already if needed.

    Erik


----- Original Message -----
From: "Hannes van der Merwe" <Ha...@meb.co.za>
To: <an...@jakarta.apache.org>
Sent: Thursday, December 06, 2001 6:17 AM
Subject: Check for environment variable existence


> In my build script I setup a property with a specific classpath. Now if
the
> environment variable: "CLASSPATH", is set before hand I need to include
this
> existing classpath into the specific classpath setup in the build script.
>
> What is the best way to check if the environment variable: "CLASSPATH" is
> set or not?
>
> Hannes van der Merwe
> Momentum Employment Benefits (IT)
> Telephone : (011) 685 4306
> Fax : (011) 685 4006
> Email : hannesv@meb.co.za
>
> E-mail disclaimer
>
> Confidentiality Warning
> =======================
> The contents of this message and any attachments are intended solely for
the
> addressee's use and may be legally privileged and/or confidential. If you
> are not the addressee indicated in this message, any retention,
> distribution, copying or use of this message is strictly prohibited. If
you
> received this message in error, kindly notify the sender immediately by
> reply e-mail and then destroy the message and any copies thereof. The
> content and any views expressed therein are, unless otherwise stated, the
> views of the author and not those of the company or any of its management
or
> directors.
> Whilst all reasonable steps are taken to ensure the accuracy and integrity
> of information transmitted, the company does not accept responsibility for
> any corruption of the information or data or breach of confidentiality as
a
> result of electronic submission.
> When addressed to the Momentum Employee Benefits clients any opinion or
> advice contained in this e-mail is subject to the terms and conditions
> expressed in any applicable terms of business.
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>