无法在运行OS X Yosemite安装JRE8 / JRE7(Unable to install

2019-10-21 11:50发布

我下载JRE8从Oracle网站( jre-8u25-macosx-x64.dmg )。 然后我打开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.'.

Answer 1:

看来要么你需要更新的Java的版本的苹果,或安装程序以某种方式下载后得到打乱。 这个问题通常可以通过固定运行更新工具,并从终端重新下载的JRE包:

打开终端,并运行这些命令:

softwareupdate -ir

检查/如果它需要更新苹果的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)


文章来源: Unable to install JRE8/JRE7 on OS X Yosemite