Reputation: 5032
I have found my JDK at /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk
I have this in my .bash_profile
export JAVA_HOME=/Library/Java
export PATH=$JAVA_HOME/bin:$PATH
I have saved my changes with source .bash_profile
Now when I try to run sudo apt get install gcc
I get this error
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/apt" (-1)
What's going on here?
Upvotes: 1
Views: 9540
Reputation: 11
For Mac users once you download and install JDK:
Command+Shift+G
/Library/Java/JavaVirtualMachines/
Go
Upvotes: -1
Reputation: 47169
Since this is more about gcc not installing as a result of not finding the java jdk, you'll want to find the current version of java used as default:
ls -l `which java`
To locate a specific version use (1.8 for example):
/usr/libexec/java_home -v 1.8
To locate all versions installed:
/usr/libexec/java_home -V
You'll need to update your PATH to reflect the location of the jdk (normally for 1.8.0 it should be):
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0)
export PATH=$JAVA_HOME/bin:$PATH
You would add that to your ~/.bash_profile
and should be back in business.
Further info: https://developer.apple.com/library/mac/qa/qa1170/_index.html
Upvotes: 7