Unable to install JRE8/JRE7 on OS X Yosemite

半世苍凉 提交于 2019-12-13 02:33:30

问题


I downloaded JRE8 from the Oracle site (jre-8u25-macosx-x64.dmg). Then I opened dmg and run the installation. The installation progress started, but then the following error occurred:

The installation failed.

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

The same error if I try to install JRE7.

I also tried to download jre-7u71-macosx-x64.tar.gz and unpack it, but after that Java refused to work correctly. java -version is fine, but the following code prints Unknown:

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

This is very strange. Has anyone run into the same issue?

UPDATE 1

I run sudo diskutil repairPermissions /

Then I run the installer again and pressed ⌘ + L. The log is:

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:


It appears either you need to update the Apple version of Java, or that the installer is getting mucked after downloading it somehow. The problem can usually be fixed by running the update tool and re-downloading the JRE package from Terminal:

Open Terminal and run these commands:

softwareupdate -ir

Check/Update Apple's version of Java if it's needed.

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

Downloads the JRE disk image to your desktop.

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

Mounts the disk image.

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

Installs the JRE package.

hdiutil detach ~/desktop/jre

Unmounts the disk.

java -version

Checks Java version.

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)


来源:https://stackoverflow.com/questions/27646540/unable-to-install-jre8-jre7-on-os-x-yosemite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!