我已经安装了Eclipse 3.5.2和JDK的Java 6为什么Eclipse不能在java 1.5中编译我的代码?
这是我在Eclipse安装的JRE
alt text http://img806.imageshack.us/img806/3345/eclipsejres.jpg
我试图用一个Ant构建文件进行编译,其中一部分看上去像这样与指定的Java 1.5:
<target name="compile" depends="build-common, init" description="Compile files. ">
<javac srcdir="${src_dir}" destdir="${build_dir}" debug="true" target="1.5" source="1.5">
<classpath path="${tomcat_home}/lib/servlet-api.jar;${tomcat_home}/lib/log4j-1.2.15.jar;/usr/local/lib/portlet-api-1.0.jar;." />
</javac>
</target>
但是,当我尝试编译,控制台窗口显示以下错误:
compile:
[javac] Compiling 1 source file to H:\jephperro\portlets\build
[javac] javac: invalid target release: 1.5
[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 ....
BUILD FAILED
H:\jephperro\portlets\CourseList-build.xml:25: Compile failed; see the compiler error output for details.
Total time: 531 milliseconds
Eclipse的问题是什么?
我们正在慢慢迁移到使用Eclipse编译器,因此我们可以依赖JRE而不是完整的JDK。 – 2010-07-15 18:53:27