Paul Taylor
Paul Taylor

Reputation: 13110

How do I install an earlier version of Java SDK on OSX

I have the Java 1.8.0_45 SDK installed on OSX Yosemite (10.10.4), but because of a bug in this release I need to go back to 1.8.0_25

I have downloaded and installed the earlier version (1.8.0_25) but even after a reboot java -versionstill shows 1.8.0_45.

I don't really understand where Java resides on OSX, but how can I get my system back so it uses 1.8.0_25

Upvotes: 0

Views: 353

Answers (2)

Matt Clark
Matt Clark

Reputation: 28599

Try and add this to your ~/.bashrc

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home

You can have multiple JRE/JDK's installed, by changing this path, you can specify which one you use each time you open a new shell.

Here is what I use in my .bashrc

JAVA_VERSION=7
JAVA_7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home
JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home

tmp="JAVA_${JAVA_VERSION}_HOME"
export JAVA_HOME=${!tmp}
export PATH=${!j}/bin:$PATH

Here, you can simply change the 7 to an 8.

This will change the JAVA_HOME, and append the bin directory to your path for general use from the command line.

note you may beed to change your java home's according to the specific release versions installed on your machine.

Upvotes: 2

Paul Taylor
Paul Taylor

Reputation: 13110

Ah found it, suprisingly easy:

macbook:JavaVirtualMachines paul$ cd /Library/Java/JavaVirtualMachines
macbook:JavaVirtualMachines paul$ ls
jdk1.7.0_40.jdk jdk1.7.0_45.jdk jdk1.8.0.jdk    jdk1.8.0_05.jdk jdk1.8.0_20.jdk jdk1.8.0_25.jdk jdk1.8.0_45.jdk
macbook:JavaVirtualMachines paul$ sudo rm -fr jdk1.8.0_45

Upvotes: 0

Related Questions