[英]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 我在OSX Yosemite(10.10.4)上安装了Java 1.8.0_45 SDK,但是由于此版本中的错误,我需要回到1.8.0_25
I have downloaded and installed the earlier version (1.8.0_25) but even after a reboot java -version
still shows 1.8.0_45. 我已经下载并安装了较早的版本(1.8.0_25),但是即使重新启动后,
java -version
仍然显示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 我不太了解Java在OSX上的位置,但是如何恢复系统以使其使用1.8.0_25
Try and add this to your ~/.bashrc
尝试将其添加到您的
~/.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. 您可以安装多个JRE / JDK,通过更改此路径,可以指定每次打开新Shell时使用的路径。
Here is what I use in my .bashrc 这是我在我的.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
. 在这里,您只需将
7
更改为8
。
This will change the JAVA_HOME, and append the bin directory to your path for general use from the command line. 这将更改JAVA_HOME,并将bin目录附加到您的路径中,以从命令行进行常规使用。
note you may beed to change your java home's according to the specific release versions installed on your machine. 请注意,您可能会根据计算机上安装的特定发行版本来更改Java主目录。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.