ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohit Mathur <geek_on_l...@yahoo.com>
Subject Problems running ant within a java application
Date Mon, 19 Jul 2004 23:59:27 GMT
Hello,

I am trying to run Ant from within a java application
as follows.

 Project project = new Project();
 File buildFile = new File(beansDir, "build.xml");
 project.setUserProperty("ant.file",
buildFile.getAbsolutePath());
 project.setUserProperty("ant.version",
Main.getAntVersion());
 project.setUserProperty("name", "mdd-ejb");
 project.setUserProperty("version", "0.1");
 project.setBaseDir(new File(beansDir));
 project.addBuildListener(new DefaultLogger());
 project.init();
 ProjectHelper.configureProject(project, buildFile);
 project.executeTarget("build");

My build file has a compile target 

  <target name="compile" depends="prepare,ejbdoclet">
    <javac destdir="${classes.dir}"
        debug="true"
        deprecation="true"
        optimize="true"
        compiler="javac1.4"
        source="1.4">
      <classpath refid="compile.classpath"/>
      <src path="${src.dir}"/>
    </javac>
  </target>

This target fails whenever I run my code saying that
it was unable to find a JVM. All other targets
(ejbdoclet - which creates the home/remote interfaces
for an ejb) work properly.

Exception occurred during event dispatching:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
	at org.apache.tools.ant.taskdefs.......

I do have a JAVA_HOME env var set. I have even tried
putting an "executable" arg to the javac tag pointing
to the javac executable. I still get the same problem.
Any help would be really appreciated.

Cheers,
Rohit.

=====
Rohit Mathur
mathur@pobox.com

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message