"Nikhil Barthwal" <nb**@iitk.ac.in> wrote in message
news:9d**************************@posting.google.c om...
Hi,
I have a Java program that needs to access the value of variable
PATH (Set in Unix enviroment by setenv or DOS enviroment by PATH
statement). How do I access it in Java?
You may execute (using method Runtime.exec()) the following command line
Windows 95/98/Me: command.com /c set
Windows NT/2000/XP: cmd /c set
Unix: env
and then parse output. It must have format like this:
<variable name>=<variable value>
By the way, Apache Ant uses this aproach. Look at:
org/apache/tools/ant/taskdefs/Execute.java