使用
ant 编译时出现如下错误:
Compiler Adapter '
org.eclipse.jdt.core.JDTCompilerAdapter ' can't be found.
build.xml如下:
<?xml version="1.0"?>
<!-- ======================================================================
2007-6-19 下午01:36:33
AntProject
description
Administrator
====================================================================== -->
<project name="AntProject" default="Build" basedir=".">
<property name="build.compiler"
value="
org.eclipse.jdt.core.JDTCompilerAdapter "/>
<property name="srcDir" location="src"/>
<property name="binDir" location="bin"/>
<property name="jarDir" location="${binDir}/lib"/>
<property name="jarFile" location="${jarDir}/AntProject.jar"/>
<!-- - - - - - - - - - - - - - - - - -
target: Initialization
- - - - - - - - - - - - - - - - - -->
<target name="Initialization">
<delete dir="${binDir}"/>
<delete dir="${jarDir}"/>
<mkdir dir="${binDir}"/>
<mkdir dir="${jarDir}"/>
</target>
<description>
description
</description>
<!-- =================================
target: Build
================================= -->
<target name="Compilation" depends="Initialization" description="--> description">
<javac srcdir="${srcDir}"
destdir="${binDir}">
</javac>
</target>
<!-- - - - - - - - - - - - - - - - - -
target: depends
- - - - - - - - - - - - - - - - - -->
<target name="Jar" depends="Initialization,Compilation">
<jar destfile="${jarFile}" basedir="${binDir}"/>
</target>
<target name="Build" depends="Initialization,Compilation,Jar">
<echo message="
Ant is building your project."/>
</target>
</project>
解决办法:
通过在Package explorer 视图中选中项目
的build.xml ,并选择 Run as -- External Tools
在对话框中选择
JRE 标签 :选中 run in the same JRE as workspace.
然后问题就解决了。