javaseleniumselenium-webdriverantbuild.xml

How to solve "[javac] error: invalid target release: 12.0.1" with command "ant run"


For error, check image

click here for image

I am attaching the compile code of my build.xml

<target name="compile" depends="init, clean">
    <delete includeemptydirs="true" quiet="true">
        <fileset dir="${test.dest}" includes="**/*"/>
    </delete>
    <echo message="making directory..."/>
    <mkdir dir="${test.dest}"/>
    <echo message="classpath----: ${test.classpath}"/>
    <echo message="Compiling.."/>
    <javac includeantruntime="false" debug="true" destdir="${test.dest}" srcdir="${test.src}" target="12.0.1" classpath="${test.classpath}">
    </javac>
</target>

Solution

  • You should only specify the Java specification version (or major version) in target of the javac task. So, instead of target="12.0.1", it should be target="12".