I am getting '**** WRONG JAVA VERSION ****' on running ant build
Asked Answered
H

2

4

My question is not this question, 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:

**** WRONG JAVA VERSION ****

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

TIP: If you are using eclipse you can configure a different JVM under Preferences->Java->Installed JREs.

Details of my system:
Java version:

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)

Javac Version:

javac 1.8.0_45

Ant Vesion:

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

Adding echo to build file:

[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

ant -diagnostics

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

Clean tag of build.xml:

<target name="clean" description="Cleans platform and all extensions">
        <callback extname="" target="before_clean"/>
        <clean/>
        <callback extname="" target="after_clean"/>
    </target>

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?

Higa answered 20/4, 2015 at 9:18 Comment(13)
See this - #950178Puddle
what is the JAVA_HOME environment variable?Adrieneadrienne
@harish.raj: I have already tried the solution mentioned there.The problem is that I am not getting any discrepancy on checking the various versions, still I am facing this issue.Higa
@krock: java_home is set to 'C:\Program Files\Java\jdk1.8.0_45'Higa
I suspect it might be an issue with the defined "clean" target in the build.xml, can you add the clean target definition to your description?Doublethink
@CeilingGecko: Can you please suggest how to do that?Higa
You are running ant commands from somewhere right? either it's an ant script or configured IDE or whatever, somewhere there should be a defined location where a build.xml is located, once you locate that find the xml element which starts with <target name="clean"> (or something like that), select that until the </target> closing tag and paste it in the description.Doublethink
@CeilingGecko: Added clean tag in the question.Higa
it looks like it's making calls to the before_clean and after_clean targets could you add those in as well? Also check if there is a <taskdef name="clean"> defined there anywhere as well, if you find it, please add that as well.Doublethink
@CeilingGecko: There is not separate tag for before_clean, after_clean or <taskdef name="clean"> Could this be a problem of ant compatibility as java 1.8.45 is the latest java release. How do I check ant compatibility?Higa
@QualtarDemix are there any import tags defined? Those targets/taskdefs might be defined in other xml files and then imported.Doublethink
@CeilingGecko: You are right. There are various import tags pointing to other files. However, all these files, in fact my entire platform folder and my entire project does not have a definition for these tags. They are referring to these tags as target but before_clean or after_clean are not defined anywhere.Higa
Your output is not generated by Ant itself, it must be something inside your build file. Ant 1.9.x itself requires Java 1.5, it is a long way away from requiring 1.7.Katharinekatharsis
H
3

Got it!!!
java 1.8.45 is not compatible with ant 1.9.1. Switched to java 1.7.67 (both jdk and jre) and everything is working fine.

Higa answered 20/4, 2015 at 10:53 Comment(1)
Why don't you change to a newer version of Ant? The latest is 1.9.4.Aldric
F
1

We can configure the java version util.xml Location: ${HYBRIS_BIN_DIR}\platform\resources\ant\util.xml .

Consider my version is 1.8, under checkenv configure the java version as contains string="${java.version}" substring="1.8" />

            <if>
            <not>
                <or>
                    <contains string="${java.version}" substring="1.7" />
                    <contains string="${java.version}" substring="1.8" />
                </or>
            </not>
            <then>
Footgear answered 13/4, 2020 at 15:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.