这是用户在 2025-6-30 14:20 为 https://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?

Java Platform, Standard Edition Installation Guide
Java 平台标准版安装指南

Contents  目录     Previous    Next  下一步

10 Installation of the JDK on macOS
10. 在 macOS 上安装 JDK

As of JDK 8u451, JavaFX is no longer included as part of Java SE 8. Please visit https://www.oracle.com/javase/javafx for more information.
从 JDK 8u451 起,JavaFX 不再包含在 Java SE 8 中。请访问 https://www.oracle.com/javase/javafx 获取更多信息。

The JDK supports both Intel-based (x64) and Apple Silicon (AArch64) Mac computers.
JDK 支持基于 Intel 的 (x64) 和 Apple Silicon (AArch64) 的 Mac 电脑。

This topic includes the following sections:
本主题包括以下部分:

System Requirements for Installing the JDK on macOS
macOS 上安装 JDK 的系统要求

For supported processors and browsers, see Oracle JDK 8 and JRE 8 Certified System Configurations.
对于支持的处理器和浏览器,请参见 Oracle JDK 8 和 JRE 8 认证系统配置

Note: Installing the JDK also installs the JRE. The one exception is that the system will not replace the current JRE with a lower version. To install a lower version of the JRE, first uninstall the current version as described in "Uninstalling the JRE".
注意 :安装 JDK 的同时也会安装 JRE。唯一的例外是系统不会用较低版本的 JRE 替换当前的 JRE。如果要安装较低版本的 JRE,请先按照 "卸载 JRE" 中的说明卸载当前版本。

JDK Installation Instruction Notation for macOS
JDK 安装指南(macOS)

JDK installers now support only one version of any Java feature release. You can't install multiple versions of the same feature release.
JDK 安装程序现在只支持任何 Java 功能发布版本中的一个版本。你不能安装相同功能发布版本的多个版本。

For example, you can't install JDK 8u381 and JDK 8u371 simultaneously. If you attempt to install JDK 8u381 after JDK 8u371 is installed, the installer uninstalls JDK 8u371 and installs JDK 8u381.
例如,你不能同时安装 JDK 8u381 和 JDK 8u371。如果你在安装了 JDK 8u371 之后尝试安装 JDK 8u381,安装程序会卸载 JDK 8u371 并安装 JDK 8u381。

Note: If you install an older version of a JDK when the newer version of the same feature family already exists, an error is displayed, prompting you to uninstall a newer JDK version if an older version has to be installed.
注意 :如果安装较旧版本的 JDK 而较新的同一功能家族版本已经存在时,会显示错误信息,提示您如果必须安装较旧版本的 JDK,则需要先卸载较新的 JDK 版本。

The JDK is installed in /Library/Java/JavaVirtualMachines/jdk-1.8.jdk regardless of the update version. For example, JDK 8u381 is installed in this directory.
JDK 安装在 /Library/Java/JavaVirtualMachines/jdk-1.8.jdk 位置,无论更新版本如何。例如,JDK 8u381 安装在该目录中。

The file name of the installer is either jdk-1.8_macos-arch_bin.dmg or jdk-1.8_macos-arch_bin.tar.gz, where arch is x64 for macmacOS64 systems or aarch64 for macOS aarch64 (64-bit ARM) systems.
安装程序的文件名是 `jdk-1.8_macos-arch_bin.dmg` 或 `jdk-1.8_macos-arch_bin.tar.gz`,其中 `arch` 是 `x64`(macOS 64 位系统)或 `aarch64`(macOS aarch64(64 位 ARM)系统)。

Determining the Default JDK Version on macOS
在 macOS 上确定默认 JDK 版本

When starting a Java application through the command line, the system uses the default JDK. There can be multiple JDKs installed on the macOS system:
通过命令行启动 Java 应用程序时,系统将使用默认的 JDK。macOS 系统上可以安装多个 JDK:

You can determine which version of the JDK is the default by entering java -version in a Terminal window. If the installed version is 20 Interim 0, Update 0, and Patch 0, then you see a string that includes the text 1-8. For example:
通过在终端窗口中输入 `java -version` 可以确定默认安装的 JDK 版本。如果安装的版本是 20 临时更新 0,更新 0,补丁 0,那么你会看到包含文本 `1-8` 的字符串。例如:

$ java -version
java version "1.8.0_381"
Java(TM) SE Runtime Environment (build 1.8.0_381-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.381-b07, mixed mode)

To run a different version of Java, either specify the full path, or use the java_home tool. For example:
要运行不同的 Java 版本,可以指定完整路径,或者使用 `java_home` 工具。例如:

$ /usr/libexec/java_home -v 8 --exec javac -version

Installing the JDK on macOS
在 macOS 上安装 JDK

When you install the Java Development Kit (JDK), the associated Java Runtime Environment (JRE) is installed at the same time.
当你安装 Java 开发工具包(JDK)时,相关的 Java 运行时环境(JRE)会同时安装。

To install the JDK on macOS:
要在 macOS 上安装 JDK:

  1. Download the required JDK .dmg or .tar.gz file from Java Downloads:
    Java 下载下载所需的 JDK .dmg.tar.gz 文件:
    • macmacOS64 systems: jdk-1.8_macos-x64_bin.dmg OR jdk-1.8_macos-x64_bin.tar.gz
      macOS64 系统:jdk-1.8_macos-x64_bin.dmgjdk-1.8_macos-x64_bin.tar.gz
    • macOS aarch64 (64-bit ARM) systems: jdk-1.8_macos-aarch64_bin.dmg OR jdk-1.8_macos-aarch64_bin.tar.gz
      macOS aarch64(64 位 ARM)系统:jdk-1.8_macos-aarch64_bin.dmg 或者 jdk-1.8_macos-aarch64_bin.tar.gz

    Click Accept License Agreement.
    点击接受许可协议。

  2. From either the browser Downloads window or from the file browser, double-click the .dmg file to start it. A Finder window appears that contains an icon of an open box and the name of the .pkg file.
    可以从浏览器的“下载”窗口,或者从文件浏览器中双击 `.dmg` 文件以启动安装。此时会弹出一个“Finder”窗口,窗口中包含一个打开的盒子图标以及 `.pkg` 文件的名称。
  3. Double-click the JDK 1.8.pkg icon to start the installation application. The installation application displays the Introduction window.
    双击 `JDK 1.8.pkg` 图标以启动安装应用程序。安装应用程序会显示“介绍”窗口。
  4. Click Continue. The Installation Type window appears.
    点击 Continue。出现 安装类型 窗口。
  5. Click Install. A window appears that displays the message: Installer is trying to install new software. Enter your password to allow this.
    点击 Install。出现一个窗口,显示消息: Installer is trying to install new software. Enter your password to allow this.
  6. Enter the Administrator user name and password and click Install Software. The software is installed and a confirmation window is displayed.
    输入管理员用户名和密码,然后点击安装软件 。软件将被安装,并显示一个确认窗口。

After the software is installed, you can delete the .dmg or .tar.gz file if you want to save disk space.
安装完成后,您可以删除 .dmg 文件。 如果想节省磁盘空间,请使用 .tar.gz 文件。

Uninstalling the JDK on macOS
卸载 macOS 上的 JDK

To uninstall the JDK on macOS, you must have Administrator privileges.
要卸载 macOS 上的 JDK,您必须具有管理员权限。

Note: Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time that you perform an update of the OS.
注意:不要通过删除 `/usr/bin` 中的 Java 工具来卸载 Java。该目录是系统软件的一部分,任何更改将在您下次更新操作系统时被重置。

  1. Go to /Library/Java/JavaVirtualMachines.  前往 /Library/Java/JavaVirtualMachines
  2. Remove the directory where the JDK is installed by running the rm command as a root user or by using the sudo tool:
    以根用户身份运行 `rm` 命令或使用 `sudo` 工具删除已安装的 JDK 目录:

    $ rm -rf jdk-1.8.jdk

Installation FAQ for macOS
macOS 安装常见问题

This topic provides answers for the following frequently asked questions about installing JDK on macOS computers.
本主题提供了关于在 macOS 计算机上安装 JDK 的常见问题的答案。

1. How do I find out which version of Java is the system default?
1. 如何查看系统默认的 Java 版本?

When you run a Java application from the command line, it uses the default JDK. If you do not develop Java applications, then you do not need to worry about this. See Determining the Default JDK Version on macOS.
当你从命令行运行 Java 应用程序时,它会使用默认的 JDK。如果你不开发 Java 应用程序,那么你不需要担心这个问题。参见 确定 macOS 上的默认 JDK 版本

2. How do I uninstall Java?
2. 如何卸载 Java?

See Uninstalling the JDK on macOS.
参见 卸载 macOS 上的 JDK

3. After installing Java for macOS 2012-006, can I continue to use Apple's Java 6 alongside the macOS JDK for Java 8?
3. 在安装了 macOS 2012-006 的 Java 后,我是否可以继续使用 Apple 的 Java 6 与 macOS JDK 8 共存?

If you want to continue to develop with Java 6 using the command line, then you can modify the startup script for your favorite command environment. For bash, use this:
如果你还想使用命令行继续开发 Java 6,可以修改你最喜欢的命令环境的启动脚本。对于 bash,可以使用以下内容:

$ export JAVA_HOME=`/usr/libexec/java_home -v 20`

Some applications use /usr/bin/java to call Java. After installing Java for macOS 2012-006, /usr/bin/java will find the newest JDK installed, and will use that for all of the Java-related command-line tools in /usr/bin. You may need to modify those applications to find Java 6, or contact the developer for a newer version of the application.
某些应用程序使用 /usr/bin/java 来调用 Java。在安装了 macOS 2012-006 版本的 Java 之后,/usr/bin/java 会找到最新安装的 JDK,并使用该 JDK 来运行 /usr/bin 下的所有与 Java 相关的命令行工具。您可能需要修改这些应用程序以找到 Java 6,或者联系开发者获取应用程序的更新版本。

4. What happened to the Java Preferences app in Application Utilities?
4. Java 馈送应用程序在 Application Utilities 中去哪里了?

The Java Preferences app was part of the Apple Java installation and is not used by Oracle Java. Therefore, macOS releases from Apple that do not include Apple Java will not include Java Preferences.
Java 馈送应用程序是 Apple Java 安装的一部分,而 Oracle Java 并不使用它。因此,不包含 Apple Java 的 Apple macOS 发行版将不会包含 Java 馈送应用程序。

Contents  目录     Previous    Next  下一步

Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. | Cookieの設定 | Ad Choices.
版权所有 © 1993, 2025, Oracle 和/或其关联公司。所有权利保留。 | Cookie 设置 | 广告选择