简体   繁体   English

ant 和 jdk 1.6 但用 1.5 编译

[英]ant and jdk 1.6 but compile with 1.5

java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)

in ant i need to compile with java 1.5.在 ant 中,我需要使用 java 1.5 进行编译。 I try like this:我像这样尝试:

<javac destdir="${dest.dir}/${package.name}/${model.dir}/${output.dir}"
           classpathref="classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}" fork="true" verbose="${verbose}"
           deprecation="${javac.deprecation}" encoding="Cp1250" source="1.5"
           target="1.5" memoryinitialsize="1024m"
           memorymaximumsize="1024m">

but it looks like ant still compile with 1.6.但看起来 ant 仍然用 1.6 编译。 Can i see which java ant use for compile?我可以看到哪个 java ant 用于编译吗? i get error of "Bad version number in .class file"我收到“.class 文件中的错误版本号”错误

Can i see which java ant use for compile?我可以看到哪个 java ant 用于编译吗?

Try this:尝试这个:

<echo message="ant.java.version: ${ant.java.version}" />

Also read this thread for more help: Ant is using wrong java version另请阅读此线程以获得更多帮助: Ant is using wrong java version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM