我从Oracle (jre-8u25-macosx-x64.dmg
)下载了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.'.
发布于 2014-12-25 13:25:44
看起来,要么您需要更新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)
https://stackoverflow.com/questions/27646540
复制相似问题