Is it possible to get the file's path referred by a shell command in Java?
For example, when I type php -v
in Windows command prompt, it would know that I am referring to C:\php\php.exe
(for my own computer) because I added that to the system Path variable. Is it possible to do the same in Java?
I know that you can get the Path environment variable from Java and parse it using String.split(";")
, but I wonder if there is a more direct way?