2

I am working on Mac OS 10.9 I did not know that macs come with java by default. So I installed my own java(version- 1.8.0_20) Now here is the confusion -

I have a java in the following locations -

/usr/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home//bin/java

whereis java returns the 1st address and which java returns the second address. So I thought something must be wrong in my environment variables. So I read up a little on that and echo $PATH returns this -

/usr/local/hive/hive-0.12.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home//bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

I also read that it can be changed in .bashrc or .bash_profile. Both these files contain this -

export PATH=$PATH

So I am not sure in which file I have to make the changes and what changes should I be making.

2 Answers 2

0

If you want the first one, change to:

export PATH=/usr/bin:$PATH

And for the second one, change to:

export PATH=/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin:$PATH

This works by overriding whatever path to Java already exists in $PATH.

You shouldn't need double slash // after Home.

0

With Mountain Lion /etc/launchd.conf is where you should set the GUI applications Path. Remember it's not a script file; it only supports launchctl commands.

Source: https://apple.stackexchange.com/questions/63662/how-to-change-path-environment-variable-to-os-x-10-8-mountain-lion-that-will-be

You should try editing launchd.conf to remove the paths that you don't need.

1
  • I personally don't have a Mac and cannot check the veracity of this answer. Oct 21, 2014 at 2:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .