Reputation: 63
I got a new mac and need to install java version 8. I downloaded it from oracle and when I run their app on their website, it says that I have the most recent version of java. When I run "java -version" is says that I am still using 1.6. How do I change this?
According to java control panel I have 1.8. However when working in eclipse it is still using 1.6.0_65. I tried uninstalling and it was unsuccessful.
My java virtual machine folder only contains 1.6.0.jdk. Do I need to move 1.8 to this folder?
Upvotes: 1
Views: 6060
Reputation: 86
When you do java -version it gives the output of current jdk in use. For that to update we need to download jdk for mac here and install it.
Go to the following url and download the appropriate file. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Upvotes: 3
Reputation: 2867
You can use jenv to switch between Java versions, it is like a Java environment manager. It is super easy to use and clean
For Mac, follow the steps:
brew install jenv
git clone https://github.com/gcuisinier/jenv.git ~/.jenv
Installation: If you are using bash follow these steps:
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
$ exec $SHELL -l
Add desired versions of JVM to jenv:
jenv add /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
jenv add /System/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home
Check the installed versions:
jenv versions
Set the Java version you want to use by:
jenv global oracle64-1.6.0
Upvotes: 0
Reputation: 29276
For eclipse to use Java 8
instead of Java 6
, follow below steps:
Eclipse
and then Select Preferences
.Compiler
in "type filter text" search box.JDK
Compliance to 1.8
Upvotes: 0
Reputation: 33779
Two options:
Upvotes: 0