无法在OS X Yosemite上安装JRE8 / JRE7

时间:2014-12-25 10:51:08

标签: java macos osx-yosemite

我从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.'.

1 个答案:

答案 0 :(得分:3)

看起来您需要更新Apple版本的Java,或者安装程序在以某种方式下载后会出现问题。通常可以通过运行更新工具并从终端重新下载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)
相关问题