我正在开发一个很久以前(可能是 2008/2009 年)创建的应用程序。现在我得到了升级服务器的任务。之前是在jdk1.4中编译的。现在我必须使应用程序与 jdk1.7 兼容。我尝试使用 jre7 编译它,并将 ant build.xml 文件的源值和目标值更改为1.7
. 并且在 ANT 构建中,jre7 被选为编译环境。我收到以下错误消息:
[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 版本:
它显示:
[echo] 使用 Java 1.7 版。
我需要进行哪些(其他)更改才能使其与 jdk1.7 一起使用?