[英]Transform application compiled in jdk1.4 to jdk1.7
I'm working on an application that has been created long time ago (maybe 2008/2009). 我正在开发很久以前(也许是2008/2009)创建的应用程序。 Now I got the task of upgrading the server.
现在,我完成了升级服务器的任务。 Previously it was compiled in jdk1.4.
以前它是在jdk1.4中编译的。 Now I have to make the application compatible with jdk1.7.
现在,我必须使该应用程序与jdk1.7兼容。 I tried to compile it with jre7 and I've changed source and target value of ant build.xml file to
1.7
. 我尝试使用jre7进行编译,并且将ant build.xml文件的源和目标值更改为
1.7
。 And also in ANT build the jre7 is selected as compiler environment. 并且在ANT构建中,选择jre7作为编译器环境。 I'm getting the following error message:
我收到以下错误消息:
[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
I tried to print the java version using following line: 我尝试使用以下行打印Java版本:
and it shows : 它显示:
[echo] Using Java version 1.7.
[echo]使用Java版本1.7。
What (other) changes do I need to make to make it work with jdk1.7? 我需要进行哪些(其他)更改才能使其与jdk1.7一起使用?
Problem Solved. 问题解决了。 I was trying to compile with JRE7 instead of jdk1.7.
我试图用JRE7而不是jdk1.7进行编译。 with jdk1.7 installed and target and source changed in ant build.xml file solved my problem.
安装了jdk1.7并在ant build.xml文件中更改了目标和源,解决了我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.