通过命令行在Windows机器上静默安装JDK 8和JRE 8 [英] Installing JDK 8 and JRE 8 silently on a Windows machine through command line

查看:902
本文介绍了通过命令行在Windows机器上静默安装JDK 8和JRE 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望在多台机器上更新JDK环境,所有运行窗口但不同版本(XP或7)

We want to update the JDK environment on multiple machines, all running windows but different versions (either XP or 7)

为此,我现在正在创建一个脚本,它将自动运行正确的安装程序(32/64位)。
我尝试使用以下命令运行安装程序:

For that purpose, I'm now creating a script which will automatically run the correct installer (32/64 bit). I tried running the installer with the following command:

jdk-8u25-windows-x64.exe / s ADDLOCAL =ToolsFeature ,SourceFeature,PublicjreFeature

这在没有安装JDK / JRE 8的机器上工作正常。但是,我遇到了一些问题:

This works fine on a machine with no JDK/JRE 8 installed. However, I am running into a few issues:


  • 如果已安装JDK / JRE 8,安装程序将同时卸载JDK& JRE而不是简单地不做任何事情(或重新安装)

  • 如果需要重新启动,则会自动强制执行,我需要避免这种情况,因为我需要执行其他操作在安装完成后的脚本中。

  • 没有VERBOSE模式/日志文件来指示安装程序实际执行的操作

我看过这些来源:

  • JDK Installation for Microsoft Windows - Installing the JDK Silently
  • Windows JRE Installer Options - Command-Line Installation

但是他们似乎缺乏并且非常混淆什么会给我想要的结果。

but they seem lacking and very confusing as to what will give me the wanted result.

推荐答案

我会解决JDK问题和JRE分开:

I would tackle JDK and JRE separately:

JDK 不依赖于注册表项或安装程序exe执行的任何其他操作。因此,使用

The JDK does not depend on registry entries or whatever else the installer exe does. So install the JDK - without Public JRE - on just one machine using

jdk-8u25-windows-x64.exe /s ADDLOCAL="ToolsFeature,SourceFeature"

然后您可以简单地压缩生成的安装,将其复制并解压缩到相同操作系统类型的其他计算机。

Then you can simply zip up the resulting installation, copy and unzip it to other machines of the same OS type.

JRE 安装程序(从Oracle单独下载)可以使用选项和配置文件运行,如下所示: http://docs.oracle.com/javase/8/docs/technotes/guides /install/windows_installer_options.html

The JRE installer (separate download from Oracle) can be run with options and config file as documented here : http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_installer_options.html

假设配置与安装程序exe位于同一目录中,则选项 INSTALLCFG =%可以使用cd%\ jre-install-options.cfg。否则,配置文件需要完整路径(INSTALLCFG =c:\ path \ to \\\ jre-install-options.cfg)。所以,像这样(使用日志文件并假设配置文件在exe的同一目录中):

Assuming the config is in the same directory as the installer exe, the option INSTALLCFG="%cd%\jre-install-options.cfg" can be used. Otherwise, a full path is required to the config file (INSTALLCFG="c:\path\to\jre-install-options.cfg"). So, something like this (with log file and assuming the config file is in the same directory of the exe):

jre-8-windows-i586.exe INSTALLCFG="%cd%\jre-install-options.cfg" /s /L C:\TMP\jre-install.log

以下jre-install-options.txt似乎可能适合您:

It seems that the following jre-install-options.txt might work for you:

INSTALL_SILENT=Enable
REBOOT=Disable
STATIC=Enable

此处列出了配置文件选项: http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html

The config file options are listed here: http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html

最后一行的含义这里解释: http:// docs。 oracle.com/javase/8/docs/technotes/guides/install/windows_installer_optio ns.html#static_installation

The meaning of the last line is explained here : http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_installer_options.html#static_installation

这篇关于通过命令行在Windows机器上静默安装JDK 8和JRE 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆