我希望在指定版本中以静默模式(实际上使用Chef)安装JDK。
我的问题是,当我添加INSTALLDIR参数时,Java安装失败。没有它,JDK将安装在默认目录中(C:/Program /Java/或C:/Program (x86)/Java/)。
我在执行命令
jdk-7u79-windows-i586.exe /s INSTALLDIR="C:/java"也尝试过
jdk-7u79-windows-i586.exe /s INSTALLDIR:"C:/java"是什么使Java安装显示弹出窗口的参数,我可以在MSI安装程序中使用。
C:/java/ path是现有目录。
此外,我还找到了这个站点:https://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html,您可以在这里找到JDK的指定参数。
我想使用主厨资源windows-包进行此安装。
windows_package node['name']['JDK1.8'] do
source node['source']['JDK1.8']
installer_type :custom
action :install
options '/s INSTALLDIR=C:/java2'
end是什么使输出
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0, 42, 127], but received '1603'
---- Begin output of start "" /wait "D:\install\jdk-7u79-windows-i586.exe" /s INSTALLDIR=C:/java & exit %%ERRORLEVEL%% ----
STDOUT:
STDERR:
---- End output of start "" /wait "D:\install\jdk-7u79-windows-i586.exe" /s INSTALLDIR=C:/java & exit %%ERRORLEVEL%% ----
Ran start "" /wait "D:\install\jdk-7u79-windows-i586.exe" /s INSTALLDIR=C:/java & exit %%ERRORLEVEL%% returned 1603我应该补充一下,我不想安装--我的目标是安装JDK。
有没有简单的方法为这些安装程序在静默模式下设置安装路径?
规格:
我会感谢你的帮助,谢谢。
发布于 2015-08-03 08:37:38
好的,我找到了这个问题的解决方案。
而不是使用类似于:
options "/s INSTALLDIR=#{node['path']['jdk']}"我不得不用这样的方法:
options "/v\"/qn INSTALLDIR=\\\"#{node['path']['JDK1.7'].gsub('/','\\')}\\\"\""这种方法可以肯定地运行JDK 6和7。以下是那些想知道如何做到这一点的人的完整例子:
windows_package node['name']['JDK1.7'] do
source node['source']['JDK1.7']
action :install
installer_type :custom
options "/v\"/qn INSTALLDIR=\\\"#{node['path']['JDK1.7'].gsub('/','\\')}\\\"\""
end但是,JDK 8有问题--使用这一行会使JDK的安装损坏:

对于JDK 8,很好地处理了这个参数:
options "/s INSTALLDIR=\"#{node['path']['JDK1.8'].gsub('/','\\')}\""谢谢你的努力!
https://stackoverflow.com/questions/31749598
复制相似问题