简体   繁体   中英

Unable to install JRE8/JRE7 on OS X Yosemite

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM