In the Apache Ant script for Java 8 I use the following line:

<javac srcdir="${src}" classpathref="classpath" destdir="${build.bin}" compiler="javac1.8" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="1.8" target="1.8" /> 

I decided to transfer the project to Java 10. I changed the specification in the script to a new version:

 <javac srcdir="${src}" classpathref="classpath" destdir="${build.bin}" compiler="javac10+" debug="true" debuglevel="lines,vars,source" includeantruntime="false" source="10" target="10" /> 

But when compiling the package on this line, it displays the message:

build.xml: 65: Class not found: javac10 +

Checking for the appropriate version of Java before the compilation starts is successful:

 <target name="check" description="Check requirements."> <echo message="Verification of your JDK version."/> <available classname="java.util.stream.Stream" property="JDK10+.present" /> <fail unless="JDK10+.present" message="Java 10 is required, but your version is Java ${ant.java.version}. Install latest JDK." /> </target> 

Tell me where I was wrong and how should the <javac/> string for Java 10 look like?

    1 answer 1

    You need to update ant to the new version, since javac10+ support appeared in version 1.10.2

    • Thank. Indeed, Eclipse Ant was version 1.10.1. - Rootware 2:29 pm