如何在Mac OS X上安装特定的JDK? [英] How to install a specific JDK on Mac OS X?

查看:180
本文介绍了如何在Mac OS X上安装特定的JDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装一个特定的JDK(例如最新的)。为此,我访问了JDK下载主页: http://java.sun.com/ JavaSE的/下载/ index.jsp的
我找了一个Mac版本,但我只是看到Linux,Windows和 Solaris ...

I want to install a specific JDK (the latest for example). For this, I went to the JDK download homepage: http://java.sun.com/javase/downloads/index.jsp. I looked for a Mac version, but I'm a bit surprised to only see downloadable versions for Linux, Windows and Solaris...

以下是Mac的消息:


Apple Computer提供他们自己的Java版本。使用软件
更新功能(Apple菜单上提供)检查您是否拥有最新的
适用于Mac的Java版本。

"Apple Computer supplies their own version of Java. Use the Software Update feature (available on the Apple menu) to check that you have the most up-to-date version of Java for your Mac."

OK但是 ...当我用Mac I更新Java时有一个 JRE 而不是JDK ......

OK BUT... when I update Java with Mac I have a JRE and not a JDK...

我不明白为什么JDK版本不存在易于下载/可安装(如解压缩的jar?)for Mac ...

I don't understand why a JDK version doesn't exist that is easily downloadable/installable (like a jar to unzip?) for Mac...

推荐答案

在@ Thilo回答的评论中,@ mobibob询问如何在你的.bash_profile中设置JAVA_HOME一台Mac。答案:

In a comment under @Thilo's answer, @mobibob asked how to set JAVA_HOME in your .bash_profile on a Mac. Answer:

export JAVA_HOME=`/usr/libexec/java_home` 

这将动态地为JAVA_HOME分配Java首选项实用程序的常规选项卡中列出的第一个JDK的位置。

This will dynamically assign to JAVA_HOME the location of the first JDK listed in the "General" tab of "Java Preferences" utility.

请参阅Apple Technical Q& A 1170: https ://developer.apple.com/library/content/qa/qa1170/_index.html

See Apple Technical Q&A 1170: https://developer.apple.com/library/content/qa/qa1170/_index.html

编辑:

如果您更喜欢使用括号来反对命令替换,那么这也有效:

If you prefer parentheses to backticks for command substitution, this also works:

export JAVA_HOME=$(/usr/libexec/java_home)

这篇关于如何在Mac OS X上安装特定的JDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆