【问题标题】:Unable to install JRE8/JRE7 on OS X Yosemite无法在 OS X Yosemite 上安装 JRE8/JRE7
【发布时间】:2014-12-25 21:25:44
【问题描述】:

我从 Oracle 网站 (jre-8u25-macosx-x64.dmg) 下载了 JRE8。然后我打开dmg 并运行安装。安装进度开始,但随后出现以下错误:

The installation failed.

The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.

如果我尝试安装 JRE7,也会出现同样的错误。

我也尝试下载jre-7u71-macosx-x64.tar.gz 并解压,但之后Java 拒绝正常工作。 java -version 很好,但是下面的代码打印了Unknown

System.out.println(System.getProperty("os.name"));

这很奇怪。有没有人遇到过同样的问题?

更新 1

我跑sudo diskutil repairPermissions /

然后我再次运行安装程序并按下⌘ + L。日志是:

installd[438]: PackageKit: ----- Begin install -----
installd[438]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “Java 8 Update 25.pkg”." UserInfo=0x7f8442b3a440 {NSFilePath=./postinstall, NSURL=file://localhost/Volumes/Java%208%20Update%2025/Java%208%20Update%2025.pkg#javaappletplugin.pkg, PKInstallPackageIdentifier=com.oracle.jre, NSLocalizedDescription=An error occurred while running scripts from the package “Java 8 Update 25.pkg”.} {
        NSFilePath = "./postinstall";
        NSLocalizedDescription = "An error occurred while running scripts from the package \U201cJava 8 Update 25.pkg\U201d.";
        NSURL = "file://localhost/Volumes/Java%208%20Update%2025/Java%208%20Update%2025.pkg#javaappletplugin.pkg";
        PKInstallPackageIdentifier = "com.oracle.jre";
    }
Installer[1667]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Installer[1667]: Displaying 'Install Failed' UI.
Installer[1667]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

【问题讨论】:

  • 尝试使用 DiskUtility 修复您的磁盘权限,然后再次运行安装程序。如果问题仍然存在,请不要关闭安装程序,而是按 Command-L ( ⌘ L ) 并发布日志结果。
  • @l'L'l 我照你说的做了
  • @l'L'l 你的意思是 pkg,而不是 dmg?我运行md5 /Users/<user_name>/Desktop/Java\ 8\ Update\ 25.pkg 得到了不同的总和,而不是2a93...(我得到了90f4...
  • 是的,.dmg2a93....pkg90f4... - 尝试从您的桌面运行 .pkg 或使用我的答案中的终端说明,看看您是否成功.如果这些都不起作用,我唯一的其他直接建议是从终端重建启动服务:/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
  • @l'L'l 执行了您在回答中所说的一切。得到同样的错误。然后运行/System/Library/Frameworks/...,但没有帮助。

标签: java macos osx-yosemite


【解决方案1】:

您似乎需要更新 Java 的 Apple 版本,或者安装程序在以某种方式下载后出现问题。该问题通常可以通过运行更新工具并从终端重新下载 JRE 包来解决:

打开终端并运行以下命令:

softwareupdate -ir

如果需要,请检查/更新 Apple 的 Java 版本。

cd ~/desktop
curl -v -j -k -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jre-8u25-macosx-x64.dmg > jre-8u25-macosx-x64.dmg

将 JRE 磁盘映像下载到您的桌面。

mkdir ~/desktop/jre
hdiutil attach -mountpoint ~/desktop/jre jre-8u25-macosx-x64.dmg

装载磁盘映像。

sudo installer -pkg ~/desktop/jre/Java\ 8\ Update\ 25.pkg -target /

安装 JRE 包。

hdiutil detach ~/desktop/jre

卸载磁盘。

java -version

检查 Java 版本。

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

【讨论】:

  • @I'L'I,sudo 安装程序命令给了我以下信息:installer: Error - You are trying to install Java 8 Update 25, however Java 8 Update 77 build 03 is already installedjava -version 命令显示-bash: java: command not found
  • 我在执行sudo installer -pkg ~/desktop/jre/Java\ 8\ Update\ 25.pkg -target /时收到错误installer: The upgrade failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
猜你喜欢
  • 2015-12-06
  • 1970-01-01
  • 2015-03-20
  • 2017-03-13
  • 1970-01-01
  • 2015-12-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多