Yes, that would be an option . . . but a more time-intensive option than I was hoping for ;-) -----
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". ----- Unless significant effort is put in to add explanatory text (such as the truly useful Log4j javadocs), the Javadocs alone cannot tell you what to do. I have seen Project.createTask(). However, it seems to be yet-another-possible path . . . as the path that I nearly-arbitrarily chose is another path. However, without GUIDANCE or a Working Example, it is difficult to pick the best path to accomplish what I need. (Not meaning to sound . . . belligerent, just frustrated. I was excited to see the API and just frustrated that I can't figure out how to use it.) Also, I have no real ties to the way I am doing it now; since it doesn't work, I'd be stupid to be wedded to it. Just looking for a method that will work. ----- This is what I am doing right now: (Quoting from an earlier email): Here is the java code that I have written that attempts to compile a "Hello, world" java file: http://home.attbi.com/~theriddells/CompileIt.java And here are the results that I get: http://home.attbi.com/~theriddells/results.txt (Note: The code has been updated to show that I have added the Project.init() called...to no avail.) ----- On 2/13/02 4:48 PM, "Erik Hatcher" <[EMAIL PROTECTED]> wrote: > How about just digging into Ant's source code and reverse engineering it? > It tells all! :) > > You can use the Project.createTask - which will set up more than just > creating a task yourself. Is that the kind of thing that you are looking > for? > > Erik > > > ----- Original Message ----- > From: "Jay Riddell" <[EMAIL PROTECTED]> > To: "Ant Users List" <[EMAIL PROTECTED]>; "Conor MacNeill" > <[EMAIL PROTECTED]> > Sent: Wednesday, February 13, 2002 7:16 PM > Subject: Re: Calling Ant from Java: An example please ? > > >> Thank you all that have responded. . . but I still need help ;-) >> >> Of all the response so far, the most relevant of which has been >> "Conor MacNeill" <[EMAIL PROTECTED]> who quoted some >> of Ant's testcases. However, I'd rather not implement it where >> it requires the use of an build.xml file. Reasons? >> - speed >> - need for inclusion of an XML parser in my final distribution. >> >> Rather, I would like an ALL JAVA, ALL SOURCE CODE, NO EXTRA JAR solution. >> >> What this means is that I *REALLY* want to figure out how to use the ANT >> API to run the Javac task. >> >> Any help in THAT direction would be much appreciated. >> >> >> On 2/13/02 2:11 PM, "Conor MacNeill" <[EMAIL PROTECTED]> wrote: >> >>> Jay Riddell wrote: >>> >>>> Yes, I am TRYING to do that. >>>> But I am failing miserably. >>>> There are NO EXAMPLES on how to do this; there is only Javadoc >>>> on the API itself (with very little extra explanatory text). >>>> >>>> OK, maybe I am not being specific enough here. >>>> >>>> Here is the java code that I have written that attempts >>>> to compile a "Hello, world" java file: >>>> http://home.attbi.com/~theriddells/CompileIt.java >>>> >>>> And here are the results that I get: >>>> http://home.attbi.com/~theriddells/results.txt >>>> >>> >>> You could look at Ant's testcases which contain the following code >>> >>> protected void configureProject(String filename) { >>> logBuffer = new StringBuffer(); >>> fullLogBuffer = new StringBuffer(); >>> project = new Project(); >>> project.init(); >>> project.setUserProperty( "ant.file" , new >>> File(filename).getAbsolutePath() ); >>> project.addBuildListener(new AntTestListener()); >>> ProjectHelper.configureProject(project, new File(filename)); >>> } >>> >>> What you would need to do then would be to replace the ProjectHelper >>> call with one that creates your targets and tasks, etc. >>> >>> Conor >>> >>> >>> -- >>> 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]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
