I have scripts where I have a Java agent that runs on several platforms (specifically Windows, Solaris, and AIX). I would like to talk about differences in the structure of the file system using environment variables in the executable command line.
As far as I can tell, there is no way to get a method Runtime.exec()for solving / evaluating any environment variables referenced by the String command (or an array of strings).
I know that if push stumbles, I can write code to preprocess the String (s) command and manually enable environment variables (using getEnv(), etc.). However, I am wondering if there is a more reasonable way to do this, as I am sure that I am not the only person who wants to do this, and I am sure that there are “pitfalls” of my own implementation.
Your recommendations and suggestions are welcome.
edit
I would like to refer to environment variables on the command line using some consecutive notation such as $ VAR and / or% VAR%. Not fussed that.
edit
To be clear, I would like to execute a command, for example:
perl $SCRIPT_ROOT/somePerlScript.pl args
Windows Unix Runtime.exec(). , , -, , (/home/username/scripts vs C:\foo\scripts). , .
.