2014-09-29 79 views
0

我正在研究很久以前(可能是2008/2009)创建的应用程序。现在我得到了升级服务器的任务。 以前它是用jdk1.4编译的。现在我必须使应用程序与jdk1.7兼容。我试图用jre7编译它,并且已经将ant build.xml文件的源和目标值更改为1.7。并且在ANT构建中,选择jre7作为编译器环境。 我收到以下错误信息:将在jdk1.4中编译的应用程序转换为jdk1.7

[javac] javac: invalid target release: 1.7 
    [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] -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] -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] -help      Print a synopsis of standard options 

我试着用下面的行打印的Java版本:

它表明:

[回音]使用Java版本1.7 。

我需要做些什么(其他)更改才能使用jdk1.7?

+1

检查你的ant xml,看是否有任何'target'参数设置为1.4 – 2014-09-29 12:06:53

+0

[invalid target release:1.7]可能的重复(http://stackoverflow.com/questions/19891423/invalid-target-release -1-7) – Seelenvirtuose 2014-09-29 12:07:42

+0

Java 1.4是2002,Java 5在2004年推出,Java 6在2006年推出。 – 2014-09-29 12:40:29

回答

0

已解决问题。 我试图用JRE7而不是jdk1.7进行编译。 与jdk1.7安装和目标和源更改ant build.xml文件解决了我的问题。

相关问题