another lame hack (ALH)
Posted Thu, 07 Aug 2003
So I got bored and after discovering that java doesn't let you (Or to my knowledge) access enviroment variables.
This will run 'java test' except it also passes a bunch of -D definitions for use in
ENVS=`env | sed -e 's/"/\"/g' | sed -e 's/^(.*)=(.*)$/-D1="2"/' | \
sed -e 's,.$,& \\,' && echo "$*"`
sh -c "java ${ENVS}"
Put that in a shell script and call it with the same parameters you'd normally call java with. ie;./lamehack.sh testThis will run 'java test' except it also passes a bunch of -D definitions for use in
System.getProperty(). For example, you could now do: System.getProperty("DISPLAY") to grab the DISPLAY enviroment variable.