title: How to select multiple JDK version in declarative pipeline Jenkins
body: <p>I want to use different JDK versions for different stages in Jenkins declarative pipeline. In the first stage I am using Java 8. In the second stage i am using Java 6. How to select multiple JDK version in declarative pipeline in Jenkins?</p>
  
  <pre><code>  pipeline {
    agent any
  
    tools {
      jdk 'jdk_1.8.0_151'
      jdk 'jdk_1.6.0_45'
    }
  
    stages {
      stage('java 8') {
        steps {
          sh 'java -version'
          sh 'javac -version'
        }
      }
      stage('java 6') {
        steps {
          sh 'java -version'
          sh 'javac -version'
        }
      }
    }
  }
  </code></pre>