You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Sharad Jain <s....@gtisoft.com> on 2004/11/16 00:00:15 UTC
Suppressing DOS window when calling Ant from Java
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
Re: Suppressing DOS window when calling Ant from Java
Posted by Laconia Data Systems <we...@laconiadatasystems.com>.
start /B
Dont ask me how I know that-
Martin-
----- Original Message -----
From: "Sharad Jain" <s....@gtisoft.com>
To: <us...@ant.apache.org>
Sent: Monday, November 15, 2004 6:00 PM
Subject: Suppressing DOS window when calling Ant from Java
> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org