You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Anna Englund <an...@accenture.com> on 2001/08/14 16:02:39 UTC

using environment variables on Solaris

Hi,

I'm trying to reach environment variables in my ant script for Solaris.

The problem I'm having is that I get an StringIndexOutOfBoundsException when ant loads the environment variables. When I run the same script on Win2K the environment variables are loaded just fine.

Any ideas?
Would be very thankful for any help!
//Anna

Basics: ant 1.3, ant-optional: 1.4 alpha, jdk 1.3.1

Script:
  <property environment="env"/>
  <echo message="HOME=${env.HOME}"/>

Output (in debug mode):
...
Build sequence for target `init' is [init]
Complete build sequence is [init, jsp, web-inf, javadoc, clean, compile, buildejb, all]

init:
 [property] Loading Environment env.

BUILD FAILED

/usr/local/wls/scripts/build.xml:30: /usr/local/wls/scripts/build.xml:30: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
/usr/local/wls/scripts/build.xml:30: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1525)
        at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
        at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
        at org.apache.tools.ant.Target.execute(Target.java:153)
        at org.apache.tools.ant.Project.runTarget(Project.java:898)
        at org.apache.tools.ant.Project.executeTarget(Project.java:536)
        at org.apache.tools.ant.Project.executeTargets(Project.java:510)
        at org.apache.tools.ant.Main.runBuild(Main.java:421)
        at org.apache.tools.ant.Main.main(Main.java:149)



Re: using environment variables on Solaris

Posted by Peter Donald <do...@apache.org>.
You probably have an oddly formatted environment variable ... can you send us 
the results of executing "set"

On Wed, 15 Aug 2001 00:02, Anna Englund wrote:
> Hi,
>
> I'm trying to reach environment variables in my ant script for Solaris.
>
> The problem I'm having is that I get an StringIndexOutOfBoundsException
> when ant loads the environment variables. When I run the same script on
> Win2K the environment variables are loaded just fine.
>
> Any ideas?
> Would be very thankful for any help!
> //Anna
>
> Basics: ant 1.3, ant-optional: 1.4 alpha, jdk 1.3.1
>
> Script:
>   <property environment="env"/>
>   <echo message="HOME=${env.HOME}"/>
>
> Output (in debug mode):
> ...
> Build sequence for target `init' is [init]
> Complete build sequence is [init, jsp, web-inf, javadoc, clean, compile,
> buildejb, all]
>
> init:
>  [property] Loading Environment env.
>
> BUILD FAILED
>
> /usr/local/wls/scripts/build.xml:30: /usr/local/wls/scripts/build.xml:30:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> --- Nested Exception ---
> /usr/local/wls/scripts/build.xml:30:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> --- Nested Exception ---
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>         at java.lang.String.substring(String.java:1525)
>         at
> org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
> at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172) at
> org.apache.tools.ant.Target.execute(Target.java:153)
>         at org.apache.tools.ant.Project.runTarget(Project.java:898)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:536)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:510)
>         at org.apache.tools.ant.Main.runBuild(Main.java:421)
>         at org.apache.tools.ant.Main.main(Main.java:149)

-- 
Cheers,

Pete

*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------*

Re: using environment variables on Solaris

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
This has been fixed in CVS. Try Ant 1.4 Beta 1.

Conor

----- Original Message -----
From: "Anna Englund" <an...@accenture.com>
To: <an...@jakarta.apache.org>
Sent: Wednesday, August 15, 2001 12:02 AM
Subject: using environment variables on Solaris


> Hi,
>
> I'm trying to reach environment variables in my ant script for Solaris.
>
> The problem I'm having is that I get an StringIndexOutOfBoundsException
when ant loads the environment variables. When I run the same script on
Win2K the environment variables are loaded just fine.
>
> Any ideas?
> Would be very thankful for any help!
> //Anna
>
> Basics: ant 1.3, ant-optional: 1.4 alpha, jdk 1.3.1
>
> Script:
>   <property environment="env"/>
>   <echo message="HOME=${env.HOME}"/>
>
> Output (in debug mode):
> ...
> Build sequence for target `init' is [init]
> Complete build sequence is [init, jsp, web-inf, javadoc, clean, compile,
buildejb, all]
>
> init:
>  [property] Loading Environment env.
>
> BUILD FAILED
>
> /usr/local/wls/scripts/build.xml:30: /usr/local/wls/scripts/build.xml:30:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> --- Nested Exception ---
> /usr/local/wls/scripts/build.xml:30:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> --- Nested Exception ---
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>         at java.lang.String.substring(String.java:1525)
>         at
org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
>         at
org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
>         at org.apache.tools.ant.Target.execute(Target.java:153)
>         at org.apache.tools.ant.Project.runTarget(Project.java:898)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:536)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:510)
>         at org.apache.tools.ant.Main.runBuild(Main.java:421)
>         at org.apache.tools.ant.Main.main(Main.java:149)
>
>
>