ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sharad Jain <s.j...@gtisoft.com>
Subject Suppressing DOS window when calling Ant from Java
Date Mon, 15 Nov 2004 23:00:15 GMT
I am trying to embed Ant into my application.
The following code gives me what I need.

executeAnt(String antfile, String target, PrintStream myOut, PrintStream 
myErr, int logLevel)
{
        ProjectHelper helper = ProjectHelper.getProjectHelper();
        Project project = new Project();
        project.init();

        logger.setMessageOutputLevel(logLevel);
        logger.setOutputPrintStream(myOut);
        logger.setErrorPrintStream(myErr);
        DefaultLogger logger = new DefaultLogger();
//        CommonsLoggingListener logger = new CommonsLoggingListener();
        project.addBuildListener(logger);
        
        helper.parse(project, new File(antfile));
        project.executeTarget(target);
}

I am able to get it working with proper logging etc.
However, I have one annoyance that I cant get rid of.
When I run this code on Windows machine, a command-windows flashes
when project.executeTarget() gets called. I believe, this is because of 
some kind
of System.out / System.err binding that happens inside createLogger() of 
Main.java ...

I know most IDE(s) (Eclipse/JBuilder) have AntRunner which are modified 
version of
Ant-Main.java and they are able to suppress DOS-window.
I dont know how ?
Any directions will be appreciated.
Thanks,
-sharad



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


Mime
View raw message