EUREKA !! An ANSWER to my problem !! I wanted to use Ant to compile. But my REAL requirement was just to be able to invoke the compiler without issuing a command line. I did *NOT* know that the compiler was there in the JDK distribution waiting for me to use it !!
Thanks to all who responded. On 2/14/02 7:29 AM, "Dominique Devienne" <[EMAIL PROTECTED]> wrote: > > I agree that using ANT is no more cross-platform than using the JDK directly > to compile Java code. > > Enclosed is a zip of 2 classes and a manifest that I wrote that encapsulate > calling the Javac compiler without java.exe. The main reason I wrote it was > so it found the JDK (1.2+) tools.jar containing the Javac compiler > automatically (so no need for a JAVA_HOME env. var. as ANT requires), and > also for doing message filtering. By looking at the Javac.java file > (ignoring the message filtering stuff), you should easily be able to call > the JDK compiler from your Java code. > > Using the filtering of message, and passing the -verbose switch to the Java > compiler, I display which classes actually get recompiled during a Javac run > (including implicitly compiled classes found through the source path), and > also reformatted the Javac error messages so Visual Studio could jump to the > error on F4. > > To run from the command line (or makefile), these 2 classes are packaged in > a tiny JAR that I run as below: > > java -jar $(JAX_DIR)\lib\JAVAC.jar -verbose [any regular Javac options] > > I hope you or anyelse finds this useful. --DD > > <<JavacShim.zip>> -----Original Message----- > From: Mark Derricutt [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, February 13, 2002 11:42 PM > To: Ant Users List; Erik Hatcher; Jay Riddell > Subject: RE: Calling Ant from Java: An example please ? > > Hmmmm, and the lack of cross platformability is where? As long as you have > tools.jar on your class path, load the load com.sun.tools.javac.Main and > work with it. > > I've never done it myself, but I'm just looking at the JEdit JCompiler > plugin code which does it, doesn't seem to hard. And I'm guessing the Ant > <javac/> task code does something similiar as well... > > > > --On Wednesday, February 13, 2002 17:07:15 -0800 Jay Riddell > <[EMAIL PROTECTED]> wrote: > >> Also, Mark asked why didn't I just call the compiler (instead of Ant)? >> Because I am trying to write cross-platform code and I was planning >> on using Ant as my "cross-platform compiler". > > > > -- \m/ -- > "...if I seem super human I have been misunderstood." (c) Dream Theater > [EMAIL PROTECTED] - ICQ: 1934853 JID: [EMAIL PROTECTED] > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
