Running ant javac inside Eclipse

You may often want to use javac task in your ant build files. In order to execute javac tasks inside Eclipse, you need to do a little bit of work. Below are the steps I follow to get javac executed succesfully. I hope it helps.

1. Define build.compiler property in your ant build file.
<project basedir="."  default="compile"  name="Test Builder">
   <property name="build" location="C:\Users\Administrator\Desktop\build"/>
   <property  value="org.eclipse.jdt.core.JDTCompilerAdapter" name="build.compiler"/>
   <target name="compile" >
     <javac srcdir="." destdir="${build}" target="1.5" source="1.5" debug="true">
   </target>
</project>

2. You should have a file named org.eclipse.jdt.core_{version}.jar located at plugins directory under your
Eclipse distribution. Extract this file into a desired location. You should see "jdtCompilerAdapter.jar"
at the extracted location.

3. Select Run->External Tools->External Tools Configuration from the Eclipse menu.

    a- Open the Classpath tab. Click on the Add External Jar button and select the jdtCompilerAdapter.jar file
        that you obtained from step 2.


    b- Open the JRE tab. Make sure to check "Run in the same JRE as the workspace" box.

Comments

Popular posts from this blog

Powerful Free Webinar Network for Oracle Developers

PL/SQL Developers! Formspider 1.9 is Out