add /usr/local/bin to $PATH got from System.getenv("PATH") in JAVA run on MAC OS
I manually installed a software which is under /usr/local/bin. I want to use it in Java. But when I use System.getenv("PATH") to get $PATH. it doesn't include /usr/local/bin. How to solve this problem?
$PATH I got from terminal:
$PATH I got in JAVA run from eclipse:
My /etc/paths is like this:
/usr/local/bin /usr/bin /bin /usr/sbin /sbin
My ~/.bashrc is like this:
export PATH=/usr/local/maven/bin:$PATH export PATH=/opt/local/bin:$PATH
There is no content in ~/.bash_profile.
You can modify the global osx path by adding a line to /etc/launchd.conf and rebooting your computer.
setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin Works in OSX 10.8 and 10.9
Setting environment variables via launchd.conf no longer works in OS X Yosemite/El Capitan
the answer "Create an environment.plist file in ~/Library/LaunchAgents/" doesn't work for me. In OSX 10.10.5 Setting environment variables via launchd.conf no longer works in OS X Yosemite/El Capitan/macOS Sierra?
Using this method, works for setting other variables but not for PATH. I have tried.