Dustin Lang <[EMAIL PROTECTED]> writes:

> Hi,
> 
> Let me pause for a moment and smack myself for sending this admittedly
> off-topic message.  (Flame at will)
> 
> *SMACK*
> 
> Okay, now, has anyone ever used sun.tools.javac to do compiling within a
> running vm?  I'm writing a versioning server that can compile java files
> and right now I'm using the most naiive way: running it as a Process.
> Blah.
> 

You could try something like this:

import sun.tools.javac.Main;
...
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    if (!new Main(out, "javac").compile(
                 new String[] {"-O", 
                               "-d", packageRoot,
                               sourceDir + "InternalRuleEvaluator.java"})) 
    {
      throw new RuleCompilationFailedException("Compilation failed: \n" +
                                               out);
    }


        Jürgen

-- 
Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
Baroper Strasse 301, D-44221 Dortmund, Germany
Phone: ++49 231/755-5806, Fax: ++49 231/755-5802

Reply via email to