title: I am getting '**** WRONG JAVA VERSION ****' on running ant build
body: <p>My question is not <a href="https://stackoverflow.com/questions/949678/ant-is-using-wrong-java-version">this question</a>, because I have no discrepancy in java versions.
  The build on running 'ant clean all' is failing after I installed java 1.8.45 (both jdk and jre).
  It says:</p>
  
  <blockquote>
    <p>**** WRONG JAVA VERSION ****</p>
    
    <p>Environment check failed: You are using a not supported version of
    Java.  Please make sure you are using Java version 1.7 or later.  Your
    current Java version is: 1.8.0_45</p>
    
    <p>TIP: If you are using eclipse you can configure a different JVM under
    Preferences->Java->Installed JREs.</p>
  </blockquote>
  
  <p>Details of my system:<br>
  <strong>Java version:</strong></p>
  
  <pre><code>java version "1.8.0_45"
  Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
  Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  </code></pre>
  
  <p><strong>Javac Version:</strong></p>
  
  <pre><code>javac 1.8.0_45
  </code></pre>
  
  <p><strong>Ant Vesion:</strong></p>
  
  <pre><code>Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
  Apache Ant(TM) version 1.9.1 compiled on May 15 2013
  </code></pre>
  
  <p><strong>Adding echo to build file:</strong></p>
  
  <pre><code>[echo] java.version  = 1.8
  [echo] java.home     = C:\Program Files\Java\jdk1.8.0_45\jre
  [echo] C:\HM\GOEP_Hybris_R2\bin\platform/tomcat/bin
  </code></pre>
  
  <p><strong>ant -diagnostics</strong></p>
  
  <pre><code>Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
  ------- Ant diagnostics report -------
  Apache Ant(TM) version 1.9.1 compiled on May 15 2013
  
  -------------------------------------------
   Implementation Version
  -------------------------------------------
  core tasks     : 1.9.1 in file:/C:/HM/GOEP_Hybris_R2/bin/platform/apache-ant-1.9.1/lib/ant.jar
  
  -------------------------------------------
   ANT PROPERTIES
  -------------------------------------------
  ant.version: Apache Ant(TM) version 1.9.1 compiled on May 15 2013
  ant.java.version: 1.8
  Is this the Apache Harmony VM? no
  Is this the Kaffe VM? no
  Is this gij/gcj? no
  ant.core.lib: C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant.jar
  ant.home: C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1
  
  -------------------------------------------
   ANT_HOME/lib jar listing
  -------------------------------------------
  ant.home: C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1
  ant-antlr.jar (11567 bytes)
  ant-apache-bcel.jar (15059 bytes)
  ant-apache-bsf.jar (9747 bytes)
  ant-apache-log4j.jar (8592 bytes)
  ant-apache-oro.jar (9711 bytes)
  ant-apache-regexp.jar (9571 bytes)
  ant-apache-resolver.jar (9642 bytes)
  ant-apache-xalan2.jar (8102 bytes)
  ant-commons-logging.jar (9720 bytes)
  ant-commons-net.jar (91275 bytes)
  ant-jai.jar (28224 bytes)
  ant-javamail.jar (13768 bytes)
  ant-jdepend.jar (13821 bytes)
  ant-jmf.jar (12278 bytes)
  ant-jsch.jar (46514 bytes)
  ant-junit.jar (112845 bytes)
  ant-junit4.jar (13065 bytes)
  ant-launcher.jar (18336 bytes)
  ant-netrexx.jar (16272 bytes)
  ant-swing.jar (13244 bytes)
  ant-testutil.jar (20998 bytes)
  ant.jar (1997485 bytes)
  
  -------------------------------------------
   USER_HOME/.ant/lib jar listing
  -------------------------------------------
  user.home: C:\Users\mohd.farrukh.chishti
  No such directory.
  
  -------------------------------------------
   Tasks availability
  -------------------------------------------
  image : Missing dependency javax.media.jai.PlanarImage
  sshexec : Missing dependency com.jcraft.jsch.Logger
  scp : Missing dependency com.jcraft.jsch.Logger
  sshsession : Missing dependency com.jcraft.jsch.Logger
  jdepend : Missing dependency jdepend.xmlui.JDepend
  A task being missing/unavailable should only matter if you are trying to use it
  
  -------------------------------------------
   org.apache.env.Which diagnostics
  -------------------------------------------
  Not available.
  Download it at http://xml.apache.org/commons/
  
  -------------------------------------------
   XML Parser information
  -------------------------------------------
  XML Parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
  XML Parser Location: unknown
  Namespace-aware parser : com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser
  Namespace-aware parser Location: unknown
  
  -------------------------------------------
   XSLT Processor information
  -------------------------------------------
  XSLT Processor : com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl
  XSLT Processor Location: unknown
  
  -------------------------------------------
   System properties
  -------------------------------------------
  java.runtime.name : Java(TM) SE Runtime Environment
  sun.boot.library.path : C:\Program Files\Java\jdk1.8.0_45\jre\bin
  java.vm.version : 25.45-b02
  ant.library.dir : C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib
  java.vm.vendor : Oracle Corporation
  java.vendor.url : http://java.oracle.com/
  path.separator : ;
  java.vm.name : Java HotSpot(TM) 64-Bit Server VM
  file.encoding.pkg : sun.io
  user.script :
  user.country : US
  sun.java.launcher : SUN_STANDARD
  sun.os.patch.level : Service Pack 1
  java.vm.specification.name : Java Virtual Machine Specification
  user.dir : C:\HM\GOEP_Hybris_R2\bin\platform
  java.runtime.version : 1.8.0_45-b14
  java.awt.graphicsenv : sun.awt.Win32GraphicsEnvironment
  java.endorsed.dirs : C:\Program Files\Java\jdk1.8.0_45\jre\lib\endorsed
  os.arch : amd64
  java.io.tmpdir : C:\Users\MOHDFA~1.CHI\AppData\Local\Temp\
  line.separator :
  
  java.vm.specification.vendor : Oracle Corporation
  user.variant :
  os.name : Windows 7
  ant.home : C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1
  sun.jnu.encoding : Cp1252
  java.library.path : C:\Program Files\Java\jdk1.8.0_45\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:\HM\GOEP_Hybris_R2\bin\platform\apa
  che-ant-1.9.1\bin;C:\windows\System32;C:\Program Files\Java\jdk1.8.0_45\bin;C:\apache-maven-3.1.1\bin;C:\oraclexe\app\oracle\product\11.2.0\server\bin
  ;;C:\ProgramData\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;.
  java.specification.name : Java Platform API Specification
  java.class.version : 52.0
  sun.management.compiler : HotSpot 64-Bit Tiered Compilers
  os.version : 6.1
  user.home : C:\Users\mohd.farrukh.chishti
  user.timezone : Asia/Calcutta
  java.awt.printerjob : sun.awt.windows.WPrinterJob
  java.specification.version : 1.8
  file.encoding : Cp1252
  user.name : mohd.farrukh.chishti
  java.class.path : C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-launcher.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-a
  ntlr.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-bcel.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-
  bsf.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-log4j.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-
  oro.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-regexp.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache
  -resolver.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-apache-xalan2.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-
  commons-logging.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-commons-net.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\
  ant-jai.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-javamail.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-jdepend
  .jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-jmf.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-jsch.jar;C:\HM\GOEP
  _Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-junit.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-junit4.jar;C:\HM\GOEP_Hybris_R2\
  bin\platform\apache-ant-1.9.1\lib\ant-launcher.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-netrexx.jar;C:\HM\GOEP_Hybris_R2\bin\pla
  tform\apache-ant-1.9.1\lib\ant-swing.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apache-ant-1.9.1\lib\ant-testutil.jar;C:\HM\GOEP_Hybris_R2\bin\platform\apa
  che-ant-1.9.1\lib\ant.jar;C:\Program Files\Java\jdk1.8.0_45\lib\tools.jar
  java.vm.specification.version : 1.8
  sun.arch.data.model : 64
  java.home : C:\Program Files\Java\jdk1.8.0_45\jre
  sun.java.command : org.apache.tools.ant.launch.Launcher -diagnostics
  java.specification.vendor : Oracle Corporation
  user.language : en
  awt.toolkit : sun.awt.windows.WToolkit
  java.vm.info : mixed mode
  java.version : 1.8.0_45
  java.ext.dirs : C:\Program Files\Java\jdk1.8.0_45\jre\lib\ext;C:\windows\Sun\Java\lib\ext
  sun.boot.class.path : C:\Program Files\Java\jdk1.8.0_45\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\rt.jar;C:\Program Files\Java\j
  dk1.8.0_45\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jce.jar;C:\Program File
  s\Java\jdk1.8.0_45\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_45\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_45\jre\classes
  sun.stderr.encoding : cp437
  java.vendor : Oracle Corporation
  file.separator : \
  java.vendor.url.bug : http://bugreport.sun.com/bugreport/
  sun.cpu.endian : little
  sun.io.unicode.encoding : UnicodeLittle
  sun.stdout.encoding : cp437
  sun.desktop : windows
  sun.cpu.isalist : amd64
  
  -------------------------------------------
   Temp dir
  -------------------------------------------
  Temp dir is C:\Users\MOHDFA~1.CHI\AppData\Local\Temp\
  Temp dir is writeable
  Temp dir alignment with system clock is 108 ms
  
  -------------------------------------------
   Locale information
  -------------------------------------------
  Timezone India Standard Time offset=19800000
  
  -------------------------------------------
   Proxy information
  -------------------------------------------
  Java1.5+ proxy settings:
  Direct connection
  </code></pre>
  
  <p>Clean tag of build.xml:</p>
  
  <pre><code>&lt;target name="clean" description="Cleans platform and all extensions"&gt;
          &lt;callback extname="" target="before_clean"/&gt;
          &lt;clean/&gt;
          &lt;callback extname="" target="after_clean"/&gt;
      &lt;/target&gt;
  </code></pre>
  
  <p>Unlike other open threads for the same issue, in this case all the versions are coherent and ant is acknowledging it. Still, it is giving this issue. Any insight?</p>