Java 无法在OS X Yosemite上安装JRE8/JRE7
我从Oracle站点下载了JRE8(Java 无法在OS X Yosemite上安装JRE8/JRE7,java,macos,osx-yosemite,Java,Macos,Osx Yosemite,我从Oracle站点下载了JRE8(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-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 repairpowpermissions/
然后我再次运行安装程序并按下⌘ + 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.'.
看起来要么你需要更新苹果版的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)
尝试使用DiskUtility修复磁盘权限,然后再次运行安装程序。如果仍然存在问题,请不要关闭安装程序,而是按
Command-L
(⌘ L)
并发布日志结果。@L'L'L我做了你所做的一切said@l我是说pkg,不是dmg?我运行了md5/Users//Desktop/Java\8\Update\25.pkg
,得到了一个不同的总数,而不是2a93…
(我得到了90f4…
)是,.dmg
是2a93…
和.pkg
是90f4…
-尝试从桌面运行.pkg
,或者使用我答案中的终端说明,看看是否成功。如果两者都不起作用,我唯一的另一个直接建议就是从终端重建launchservices:/System/Library/Frameworks/CoreServices.framework/Frameworks/launchservices.framework/Support/lsregister-kill-r-domain local-domain-System-domain user
@l'l执行了你在回答中所说的一切。我也犯了同样的错误。然后运行/System/Library/Frameworks/…
,但它没有帮助。@I'L'I,sudo installer命令给出以下信息:安装程序:错误-您正在尝试安装Java 8 Update 25,但是,Java 8 Update 77 build 03已经安装
,但是Java-version
命令显示-bash:Java:command未找到
。我收到一个错误安装程序:升级失败(安装程序遇到了导致安装失败的错误。请与软件制造商联系以获取帮助。)
当我执行sudo安装程序-pkg~/desktop/jre/Java\8\Update\25.pkg-target/