title: How to set Jenkins JDK/Environment before deployment?
body: <p>we want to provide an auto-installer for my company. So that the developers do not have to set up their workbench with a very long installation guide.
  We managed to provide 90%. </p>
  
  <p>Last week we received an email that we should configure Jenkins during the installation. 
  The first part of configuring the Proxy Setting is via a groovy script.</p>
  
  <p><strong>Groovy file:</strong></p>
  
  <pre><code>pc = new hudson.ProxyConfiguration(name, port, userName, password, noProxyHost);
  jenkins.model.Jenkins.instance.proxy = pc;
  println "Jenkins-Proxy settings updated!
  </code></pre>
  
  <p><strong>Commandline</strong> </p>
  
  <pre><code>type set setJenkinsProxy.groovy | java -jar jenkins-cli.jar -s 
  http://localhost:8080/jenkins groovy =
  </code></pre>
  
  <p>The next part is to set the already installed JDK.
  First thought was to use a groovy script to set the JDK.</p>
  
  <p><strong>Groovy file:</strong></p>
  
  <pre><code>jdk = new hudson.model.JDK(name, home, list);
  jdklist = []
  jdklist.add(jdk)
  jenkins.model.Jenkins.instance.JDKs = jdk;
  println "JDK settings updated!
  </code></pre>
  
  <p>Even with a runnable .jar file, that will use the jenkins-cli.jar, it didn't work.</p>
  
  <p><strong>JDK.jar</strong></p>
  
  <pre><code>public static void main(String[] args) {
  
              JDK jdk = new JDK(args[0], args[1]);
  
              List&lt;JDK&gt; jdklist = new ArrayList&lt;JDK&gt;();
              jdklist.add(jdk);
              jenkins.model.Jenkins.jdks = jdklist;
  
              System.out.println("Jenkins JDK set!");
  
          }
  </code></pre>
  
  <p>Is there a proper way to set this Environment? I would really appreciate any way of help.</p>
  
  <p>EDIT:
  Would like to set Jenkins Location as well as Email- Notification too.</p>