This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes General Computing and the fly likes environment variables and substitution into properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "environment variables and substitution into properties" Watch "environment variables and substitution into properties" New topic
Author

environment variables and substitution into properties

Clayton Cramer
Ranch Hand

Joined: Aug 26, 2010
Posts: 41
If you define a property that includes ${ENV[varname]}, when you call getProperty for that property, it will substitute the environment variable varname in place of the ${ENV[varname]}. At least, it does it when I run on Windows. But when I run on Suse Linux 11, it does not: ${ENV[varname]} remains in the property string, with no substitution. I can see the environment variable present in bash--but the substitution does not take place when I retrieve the property. Any suggestions where to start looking?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36452
    
  15
Don’t know. Sorry. But not amongst us beginners who frequent this area of cyberspace, so I shall move this thread.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7014
    
  16

Clayton Cramer wrote:If you define a property that includes ${ENV[varname]}, when you call getProperty for that property, it will substitute the environment variable varname in place of the ${ENV[varname]}. At least, it does it when I run on Windows. But when I run on Suse Linux 11, it does not: ${ENV[varname]} remains in the property string, with no substitution. I can see the environment variable present in bash--but the substitution does not take place when I retrieve the property. Any suggestions where to start looking?

Like Campbell, I was completely unaware of such a construct in Java (and I see no reference to it in the java.util.Properties documentation - version 6, at least).

Perhaps you could explain where this definition comes from?

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36452
    
  15
I tried googling and found this, which seems to be related to Ant.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7014
    
  16

Campbell Ritchie wrote:I tried googling and found this, which seems to be related to Ant.

Cheers mush.

Winston
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: environment variables and substitution into properties
 
Similar Threads
Object properties.
c:set var
Linux Commands from java.
CATALINE_HOME
BUILD FAILED ${env.JBOSS_HOME}\client not found.