title: Unsupported major.minor version 52.0 - trying to look for Java 8, which is already set in Java_home and Path
body: <p>I am trying to run my automation code built in cucumber framework by Jenkins job, in which environment variables are set by injecting via build setup. I am getting the following error.</p>
  
  <pre><code>[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
  [EnvInject] - Injecting as environment variables the properties content 
  PATH=/data/java/jdk180152/bin:/data/build_tools/maven/apache-maven-3.5.2/bin:/data/build_tools/python/python-2.7.14/bin/:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:
  M2_HOME=/data/build_tools/maven/apache-maven-3.5.2
  JDK_HOME=/data/java/jdk180152
  JAVA_HOME=/data/java/jdk180152
  MAVEN_HOME=/data/build_tools/maven/apache-maven-3.5.2
  
  [EnvInject] - Variables injected successfully.
  Parsing POMs
  Established TCP socket on 33831
  [cafeAutomation] $ java -cp /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12-alpha-1.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven-3.5.2/boot/plexus-classworlds-2.5.2.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven-3.5.2/conf/logging jenkins.maven3.agent.Maven35Main /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven-3.5.2 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.14.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12-alpha-1.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12-alpha-1.jar 33831
  Exception in thread "main" java.lang.UnsupportedClassVersionError: hudson/remoting/Launcher : Unsupported major.minor version 52.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
      at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
      at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
      at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:133)
      at jenkins.maven3.agent.Maven35Main.main(Maven35Main.java:64)
  ERROR: ================================================================================
  ERROR: Invalid project setup: Connection reset
  ERROR: Processing failed due to a bug in the code. Please report this to the issue tracker (https://jenkins.io/redirect/report-an-issue).
  java.lang.NullPointerException
      at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:304)
      at hudson.maven.ProcessCache.get(ProcessCache.java:236)
      at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:804)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
      at hudson.model.Run.execute(Run.java:1724)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:421)
  project=hudson.maven.MavenModuleSet@6b7062ed[smr-qa-maven]
  project.getModules()=[hudson.maven.MavenModule@10ea4a41[smr-qa-maven/cafeAutomatin:cafeAutomation][smr-qa-maven/cafeAutomation:cafeAutomation][relativePath:WebApp/Automation Scripts/CAFE Automation Scripts/cafeAutomation]]
  project.getRootModule()=hudson.maven.MavenModule@10ea4a41[smr-qa-maven/cafeAutomation:cafeAutomation][smr-qa-maven/cafeAutomation:cafeAutomation][relativePath:WebApp/Automation Scripts/CAFE Automation Scripts/cafeAutomation]
  FATAL: null
  </code></pre>
  
  <p>Java version installed on the box - Java 8,
  Maven - 3.5.2,
  Jenkins version - 2.89.3</p>
  
  <p>In my pom.xml file, I have mentioned the plugin as </p>
  
  <pre><code>&lt;plugin&gt;
  
  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
  &lt;version&gt;3.6.1&lt;/version&gt;
  
  &lt;configuration&gt;
  &lt;compilerVersion&gt;1.8&lt;/compilerVersion&gt;
  &lt;source&gt;1.8&lt;/source&gt;
  &lt;target&gt;1.8&lt;/target&gt;
  &lt;fork&gt;true&lt;/fork&gt;
                      &lt;executable&gt;/data/java/jdk180152/bin/javac&lt;/executable&gt;
  
  &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Have also tried by adding the following to the pom file, but still the same error</p>
  
  <pre><code>&lt;properties&gt;
          &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
      &lt;/properties&gt;
  </code></pre>