Java JDK installation silencieuse avec chemin spécifié


Je veux installer en mode silencieux (en fait, en utilisant Chef) JDK dans la version spécifiée.

Mon problème est que lorsque j'ajoute le paramètre INSTALLDIR, l'installation de Java JDK échoue. Sans cela, JDK s'installera dans le répertoire par défaut ( C:/Program Fichiers / Java/ ou C:/Program Les fichiers (x86) / Java / ).

J'exécute la commande

jdk-7u79-windows-i586.exe /s INSTALLDIR="C:/java"

Et aussi essayé

jdk-7u79-windows-i586.exe /s INSTALLDIR:"C:/java"

Qu'est-ce qui rend l'installation Java afficher la fenêtre contextuelle avec les paramètres que je peux utiliser dans le programme d'installation MSI.

C:/java / le chemin est un répertoire existant.

De plus, j'ai trouvé ce site: https://docs.oracle.com/javase/7/docs/webnotes/install/windows/jdk-installation-windows.html où vous pouvez trouver les paramètres spécifiés pour JDK.

Je veux utiliser Chef resource windows-package pour cette installation

windows_package node['name']['JDK1.8'] do
    source                  node['source']['JDK1.8']
    installer_type          :custom
    action                  :install
    options                 '/s INSTALLDIR=C:/java2'
end

Ce qui rend la sortie

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

Je devrais ajouter Je ne veux pas installer JRE - mon objectif est d'installer JDK.

Y a-t-il moyen simple de configurer le chemin d'installation pour ces installateurs en mode silencieux?


Spécification:

  • Chef 12.4.1
  • Microsoft Windows 7
  • Versions de JDK je voudrais installer: 6u35, 7u79 et 8u45.

J'apprécierai toute aide, merci.

Author: deem, 2015-07-31

1 answers

Ok, j'ai trouvé une solution à ce problème.

Au Lieu d'utiliser quelque chose comme:

options     "/s INSTALLDIR=#{node['path']['jdk']}"

, j'ai dû utiliser quelque chose comme ceci:

options     "/v\"/qn INSTALLDIR=\\\"#{node['path']['JDK1.7'].gsub('/','\\')}\\\"\""

De Cette façon, travaille pour vous que JDK 6 et 7. Voici pleins exemple pour ceux qui se demandent, comment le faire:

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 a cependant un problème-l'utilisation de cette ligne rend l'installation de JDK corrompue:

Échec de l'installation de JDK

Pour JDK 8 a bien fonctionné ce paramètre:

options     "/s INSTALLDIR=\"#{node['path']['JDK1.8'].gsub('/','\\')}\""

Merci pour tous vos efforts!

 2
Author: deem, 2015-08-03 08:37:38