Welcome to the Ranch!
$PATH is resolved by the shell, so you'll need to execute this command using a shell:
sh -c $PATH. If you're using Windows, the command should be
cmd /C echo %PATH%. Note that Windows uses
%PATH% instead of
$PATH.
Edit: basically what N Sahni said
There is just one flaw in that code: the error stream should also be read. See
When Runtime.exec() won't. In this case the solution is simple: add
process.redirectErrorStream(true); before line 7.