I need to switch the Java version on my Mac OS X 10.8.4
but am not sure how, the version I have right now is 1.6.0_51
but i want to switch to 1.6.0_45
:
$java -version java version "1.6.0_51" Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509) Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode) /usr/libexec/java_home -v 1.6.0_43 Unable to find any JVMs matching version "1.6.0_43". /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
I assume there is no such a version as 1.6.0_43
on my mac? how can install it and then switch to it? thanks!
Best Answer
To see which versions you have installed use:
For example shows this for me:
Then simply in your
~/.bashrc
or~/.bash_profile
:As for getting version 1.6 (or nearly any prev version) I think that as of this date (Nov 2018) you will be out of luck. I can get to https://jdk.java.net/8/ but any earlier version is a 404 (11 is the latest). I'm sure you could search a bit more though as I understand it, once they (Oracle) have discontinued a version, they no longer maintain it since it could be a security risk.
Once you have DL a Mac .dmg, I'm sure it installs in the correct location and will be visible with
java_home
.There is information at https://stackoverflow.com/a/47699905/1019307 that discusses using
homebrew
to install Java and it mentions Java6 (the post is dated Dec 2017).