How to solve "[javac] error: invalid target release: 12.0.1" with command "ant run"
How to solve "[javac] error: invalid target release: 12.0.1" with command "ant run"
如有错误,请检查图片
我附上我的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>
您应该只在 javac
任务的目标中指定 Java 规范版本(或主要版本)。所以,而不是 target="12.0.1"
,它应该是 target="12"
.
如有错误,请检查图片
我附上我的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>
您应该只在 javac
任务的目标中指定 Java 规范版本(或主要版本)。所以,而不是 target="12.0.1"
,它应该是 target="12"
.