在ant构建无效的目标版本问题 [英] problem in ant build invalid target release

查看:2145
本文介绍了在ant构建无效的目标版本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Ant构建问题

[javac] Compiling 86 source files to F:\XXX\classes
    [javac] javac: invalid target release: 1.6
    [javac] Usage: javac <options> <source files>
    [javac] where possible options include:
    [javac]   -g                         Generate all debugging info
    [javac]   -g:none                    Generate no debugging info
    [javac]   -g:{lines,vars,source}     Generate only some debugging info
    [javac]   -nowarn                    Generate no warnings
    [javac]   -verbose                   Output messages about what the compiler is doing
    [javac]   -deprecation               Output source locations where deprecated APIs are used
    [javac]   -classpath <path>          Specify where to find user class files
    [javac]   -cp <path>                 Specify where to find user class files
    [javac]   -sourcepath <path>         Specify where to find input source files
    [javac]   -bootclasspath <path>      Override location of bootstrap class files
    [javac]   -extdirs <dirs>            Override location of installed extensions
    [javac]   -endorseddirs <dirs>       Override location of endorsed standards path
    [javac]   -d <directory>             Specify where to place generated class files
    [javac]   -encoding <encoding>       Specify character encoding used by source files
    [javac]   -source <release>          Provide source compatibility with specified release
    [javac]   -target <release>          Generate class files for specific VM version
    [javac]   -version                   Version information
    [javac]   -help                      Print a synopsis of standard options
    [javac]   -X                         Print a synopsis of nonstandard options
    [javac]   -J<flag>                   Pass <flag> directly to the runtime system


BUILD FAILED

蚁源和目标1.6
恩变量路径JDK 1.6

ant source and target to 1.6 en variable path to jdk 1.6

推荐答案

您使用编译器不能用编译 -target 1.6 (javac的:无效的目标版本:1.6) 。你确定你使用JDK 1.6?也许一个JDK 1.5的安装和蚂蚁使用。检查的Java版本与添加下面一行到你的目标(开头):

You use a compiler that cannot compile with -target 1.6 (javac: invalid target release: 1.6). Are you sure you use the JDK 1.6? Maybe a JDK 1.5 is installed and used by ant. Check the used Java-version with adding following line to your target (at the beginning):

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

据输出由蚂蚁使用的Java版本。

It outputs the Java-version used by Ant.

您可以设置编译器使用不同的Java版本。你必须用叉子属性使用外部的javac并指定要哪一个:

You can set the compiler to use a different Java-version. You have to use the fork-attribute to use an external javac and specify which one you want:

<javac srcdir="${src}"
         destdir="${build}"
         fork="yes"
         executable="/opt/java/jdk1.6/bin/javac"
  />

阅读的javac任务的文档的详细信息。

这篇关于在ant构建无效的目标版本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆