[英]Transform application compiled in jdk1.4 to jdk1.7
我正在開發很久以前(也許是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一起使用?
問題解決了。 我試圖用JRE7而不是jdk1.7進行編譯。 安裝了jdk1.7並在ant build.xml文件中更改了目標和源,解決了我的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.