I've been struggling to find a reason why my Java application does not use the default PATH environment variable. I need it to launch another program with ProcessBuilder. Right now I get "Cannot run program "..." error=2, No such file or directory
", though I can run this program from the terminal. I'm using JDK 1.8, Netbeans 8.1, OS X.
Here's the output of System.out.println(System.getenv("PATH"));
:
/usr/bin:/bin:/usr/sbin:/sbin
The actual value of PATH in the terminal (using echo $PATH
) is much longer and contains the paths to the desired executables.
I found some questions treating on the same subject but none could help me with this.
Any help appreciated!