--- Jay Riddell <[EMAIL PROTECTED]> wrote:
> I have an application where I need to dynamically generate Java source
> code, compile it, load it and then execute that code.
[snip]
> However, I'm sure that I'm not doing anything really difficult...I'm
> just doing it wrong ;-).  A "compile Hello World"-type example would
> save me BUNCHES of work and would be MUCH appreciated.

If I understand right what you want to do (but given the past two days,
that's anybody's guess :), here's an example:

  <target name="runHello" depends="gensrc,compile">
    <java classname="HelloWorld" >
      <classpath>
        <pathelement location="."/>
      </classpath>
    </java>
  </target>

  <target name="compile">
    <javac srcdir="." destdir="." includes="HelloWorld.java"/>
  </target>

  <target name="gensrc">
    <echo file="HelloWorld.java">public class HelloWorld
{
  public static void main (String [] args)
  {
      System.out.println("Hello, world") ;
  }
}
    </echo>
  </target>

Diane

=====
([EMAIL PROTECTED])



__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to