File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes General Computing and the fly likes environment variables and substitution into properties Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Reply 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
Greenhorn

Joined: Aug 26, 2010
Posts: 23
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: 26716
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: 1604

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


More computing sins are committed in the name of efficiency (without necessarily achieving it)
than for any other single reason...including blind stupidity. — W.A. Wulf
Campbell Ritchie
Sheriff

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

Joined: Mar 17, 2011
Posts: 1604

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

Cheers mush.

Winston
 
IntelliJ Java IDE
 
subject: environment variables and substitution into properties
 
Threads others viewed
c:set var
Object properties.
CATALINE_HOME
BUILD FAILED ${env.JBOSS_HOME}\client not found.
Linux Commands from java.
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture