TAGS :Viewed: 3 - Published at: a few seconds ago

[ Can't compile Java-8 source code with Ant v1.9.4 in (CLI) ]

I can't compile following with JDK8 & Ant v1.9.4 with CLI.

build.xml:

<?xml version="1.0" ?>
<project default="Compile">
    <target name="Compile">
        <mkdir dir="classes"/>
        <javac
            srcdir="src"
            includes="**/*.java"
            destdir="classes"
            source="1.8"
            target="1.8"
            debug="false">
        </javac>
    </target>       
</project>

Error:

ction.java:118: error: cannot find symbol
    [javac]                             userId= Long.parseUnsignedLong(uid);
    [javac]                                             ^
    [javac]   symbol:   method parseUnsignedLong(String)
    [javac]   location: class Long
    [javac] 1 error

BUILD FAILED E:\dbcommon\build.xml: 176: Compile failed; see the compiler error output for details.

Of course the package exists and it works within Eclipse, but not with the CLI! I only have this JDK installed, no other version, JAVA_HOME is set to JDK (not the included JRE)!

Any suggestions would be great!

Answer 1


Edit the ANT HOME path in the Eclipse.

Right click on the build.xml file >> Run as >> External tool configurations >> Select the classpath tab. Now change the ANT Home path from here.

enter image description here