How to call Jakarta Ant via JAVA?

Hi.
My application has a new menu. This menu creates a build.xml Ant file.
Now, when this menu is invoked , its action should call
Jakarta Ant, after creating the xml file, so that the build.xml will
do what is necessary.
How can I do it? That is, how to call the Ant via java?
Is there any way to use an Ant object?
Thanks?
Rodrigo Pimenta Carvalho.

There is a slight problem in that
PorjectHelper.configureProject is deprecated, but
that is what Main calls...maybe someone else will
complete this thread with an alternative call.The javadoc recommends using the non static method parse() instead. This is available by implementing class ProjectHelperImpl. An alternative to the code above might look like this:
        Project ant = new Project();
        ProjectHelper helper = new ProjectHelperImpl();
        ant.init();
        helper.parse(ant, new File("build.xml"));
        ant.executeTarget("clean");you might also want to add a logger so you can see the output of events generated by ant. The DefaultLogger class would be used like this. Simply add the code before you call the ant.init().
        DefaultLogger log = new DefaultLogger();
        log.setErrorPrintStream(System.err);
        log.setOutputPrintStream(System.out);
        log.setMessageOutputLevel(Project.MSG_INFO);
        ant.addBuildListener(log);

Similar Messages

  • How to call Oracle Reports via Java Web Application ?

    Dear All,
    I have developed a web reports using Oracle Reports 11g and would like to display these reports via Java Web App that will call them.
    Kindly help me in this matter.
    Regards,
    Irfan

    i will go as John suggested.........Construct a URL with required parameters and call it using goLink component
    make a configuration in Report server and
    http://myServer:myport/reports/rwservlet?config=myconfig&destype=cache&desformat=PDF&report=myreport.jsp&myparameter=myvalue

  • How to invoke ant via java

    Hi.
    My application has a gui. Now, when a button in the gui is invoked, its action should invoke Ant build which is existing , so that the build.xml will
    do what is necessary.
    How can I do it? That is, how to call the Ant via java? can anybody help me
    Thanks in advance

    Search the ant documentation for a Launcher class.

  • How to call imported ant target/task in Java

    Hi,
    Can anybody advice me how to call an ant target/task, which is
    "<import/>"ed from another build file, from within Java code?
    Here's my Java code:
    import org.apache.tools.ant.*;
    import java.io.*;
    import java.util.*;
    public class MyTest
    private Project project;
    public void init(String buildFile, String baseDir) throws
    Exception
    project = new Project();
    try { project.init(); }
    catch (BuildException e)
    { throw new Exception("The default task list could not be
    loaded."
    // Set the base directory. If none is given, "." is used.
    if (_baseDir == null) _baseDir=new String(".");
    try { project.setBasedir(_baseDir); }
    catch (BuildException e)
    { throw new Exception("The given basedir doesn't exist, or
    isn't a directory."); }
    if (_buildFile == null) _buildFile=new String("a.xml");
    try { ProjectHelper.getProjectHelper().parse(project, new
    File(_buildFile)); }
    catch (BuildException e)
    { throw new Exception("Configuration file "+_buildFile+" is
    invalid, or cannot be read."); }
    public void runTarget(String _target) throws Exception
    // Test if the project exists
    if (project == null) throw new Exception("No target can be
    launched because the project has not been initialized. Please call the
    'init' method first !");
    // If no target is specified, run the default one.
    if (_target == null) _target = project.getDefaultTarget();
    // Run the target
    try { project.executeTarget(_target); }
    catch (Exception e)
    { throw new Exception(e.getMessage()); }
    public static void main(String args[])
    try{
    MyTest mytest=new MyTest();
    mytest.init("c.xml",".");
    mytest.runTarget(null);
    }catch(Exception e)
    e.printStackTrace();
    Here are my build files: (they look almost the same. But it's only to see if <import> works.)
    1.c.xml:
    <project basedir="." default="runtests" name="TestC">
    <import file="a.xml"/>
    </project>
    2. a.xml:
    <project basedir="." default="runtests" name="TestA">
    <target name="runtests" depends="">
    <mkdir dir="ttt"/>
    </target>
    </project>
    If I directly set build file "a.xml" in MyTest.java, everthing works
    well. However, if set "c.xml" then do task "<mkdir dir="ttt"/>" defined
    in "a.xml" which was imported by "c.xml", when running, I got an
    exception. Looks like it can't parse my c.xml which include "import".
    BTW, I'm using ant 1.6.2, and running "ant -f c.xml" was ok.
    Did I miss any classpath or something? Any idea?
    Thanks,
    Amy

    I have a standard Ant build script for signing a jar file. I import it into my master Ant build files with
    <import file="Sign.xml"/>
    and then in my master Ant script I setup the name of the jar file e.g.
    <property name="jar-file" value="${fun}/FunApplet.jar"/>
    and then invoke a target
    <target name="sign-jar" depends="jar, sign">
    </target>
    Since this target (sign-jar) depends on target 'jar' and target 'sign' it executes the 'jar' target and then the 'sign' target that is contained in Sign.xml.

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How To Call HTML Page Through Java Swing Page  ???....

    Hi All ;
    Please Can You Tell Me How To Call HTML Page Through Java Swing Page ....
    Regards ;

    Hi,
    you can use HTML fragments on a panel.
    http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
    However, to integrate a browser you need 3rd party software like IceBrowser
    If you Google for: HTML Swing
    then you find many more hints
    Frank

  • How to call gnuplot command from java

    Hi there,
    In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
    By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
    Thanks a lot for any suggestions!
    Jack

    Hi, there:
    Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
    BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
    Thanks,
    Jack
    P.S. Would you guys answer my question after I use up my duke dollars? :- )

  • How to access calendar rules via java

    Hi to all,
    We have a process in which we need to set a Timer, but the date must be validated against Calendar Rules. We searched in forums, webs, documentation and we couldn't find a way to do this.
    I know it is possible to set an expiration date based on Business Calendar on a Human Task (deadline tab in Human task editor), but this is not what we need.
    We actually need a way to set a variable date in the process that can handle only business days. e.g.: 'now' + 2 business days.
    Right now we are setting the Timers with this expression from a Business Rule: Duration.from string("PT48H")
    Then I associate the business rule output with a Time type variable(deadlineTime) doing: 'now' + deadlineTime
    So right after that I can use the Time variable on a timer attached to the human tasks I need. * We need to use business rules because the customer may want to change the times accordingly to their needs through BPM Composer. *
    The problem is that this solution does not take into account Saturday and Sundays (holidays are a concern too).
    We need to set the expiration time to timers attached to human tasks, but the time should consider working days only. We consulted with experts from Oracle and told us that functionality is available in the PS 6 version. At the moment it is impossible to migrate to that version. I need to know how to access via Java APIs to the calendar rules for checking programmatically.
    JDeveloper version: 11.1.1.6
    Any suggestion?
    Thanks in advance
    Marcelo

    Hi Yarner,
    Once you have all your dll included in a jar and used the nativelib tag, you have to use, at the beginning of you application, the command System.loadLibrary to load all the dll you need. Including the ones called by the others you have direct access.
    The dll�s have to be explicitly loaded in the order they are called.
    For example: you use lib1.dll and lib2.dll. The lib1.dll needs lib0.dll.
    Even if you don't use lib0.dll directly, once its called by lib1.dll you have to put then in the order.
    System.loadLibrary("lib0.dll");
    System.loadLibrary("lib1.dll");
    System.loadLibrary("lib2.dll");
    I hope it may help you, good luck.
    Mario

  • How to call a stand alone java application from ADF BC JSP, struts or JSF

    Hi,
    My requirement is that there are utilities or stand alone java applications that I want to call from our existing applications.
    We have two seperate applications one ADF BC Struts application we developed using JDeveloper 10.1.2 and another ADF BC JSF application we developed using JDeveloper 10.1.3.2.
    We want to integrate applications like JTwain and others to help us in scanning. The application will be placed on the same server as our application. How can I do this without loosing all the current session information.
    Please help.
    Thanks and regards,

    There are two possible solutions.
    First, if the tool or application you want to integrate, has an Java-API you can use this api and integrate the tool in your application (using one or more jars you add to the classpath).
    Second, if the tool has no java api, you can call the tool via runtime.exec(...) as a shell process. This way you open a command shell in you application and execute the tool like you do on a normal command shell.
    For tide integration and control I recommend the first approach. The second one is only for those tools which don't offer a java api.
    Timo

  • How to call BPM process from Java

    Hi All,
    Can anybody help how to call a BPMN process from java.Please give any sample exaple on this.
    Thanks,
    Ganesh

    For 11g BPM please look at this post. Re: Getting while running the BPEL process from java
    It references an ATeam example app that can start processes from a web client. But the Java APIs are described too.

  • Calling stored procedure via java

    Hi all,
    i have a problem calling a stored procedure in my java code. I found an example at OTN which seems not to be correct. I know there had been a lot of posting regarding this isue but i did not find the solution.
    I had the following VB-code to translate to java:
    Set k = Server.CreateObject("ADODB.command")
    With k
    .activeconnection = Db
    .CommandType = 4
    .CommandText = "Get_SK"
    Set vret = .createparameter("vRet", 131, 2) 'Output
    .Parameters.append vret
    .Execute
    End With
    In my java code:
    CallableStatement sproc_stmt = null;
    try {
    sproc_stmt = lsession.connection().prepareCall("{ ? = call TCSDBOWNER.Get_SK}");
    sproc_stmt.registerOutParameter(1,OracleTypes.NUMERIC);
    sproc_stmt.setFetchSize(10);
    sproc_stmt.execute();
    The call generates an id for inserting new rows in the DB. executing the code shown above i got the following error:
    wrong number or types of parameter/arguments
    Is there anybody who can help me? Best regards,
    ak

    Hi again,
    this was really ugly:
    Re: Executing stored procedure via java
    Thanks all, regards,
    ak

  • How to call c++ code from java

    i have a third party dll written in c++. I want to call its methods in java. I searched web and found that I have to use JNI for this. I have seen examples on web writing c++ code and then using it from java through JNI, but can anybody please point to me the example where i have a predefined library or dll in c++ and i have to call it in java. I think that I may have to declare methods in library as native in java and then write a wrapper implementation (dll) in c++ which actually calls the library or dll functions. But, then how will I call methods of dll from my wrapper code.
    Any examples, please point
    Regards,
    Farooq

    There's a JNI forum here that may be a better place for this question; though given the general nature of the question, I suspect that they'll refer you to a tutorial. good luck.

  • Calling XI interfaces via Java

    Hi All,
    What is the method to call a Interface in XI via Java?
    Regards,
    Keerti

    are you talking about Java Proxy ?
    You can connect to an external Java based system via a Java proxy (XI adapter) - http://help.sap.com/saphelp_nw04/helpdata/en/e1/091640a991c742e10000000a1550b0/content.htm
    Also have a look at these weblogs;
    /people/prasad.ulagappan2/blog/2005/06/27/asynchronous-inbound-java-proxy
    /people/rashmi.ramalingam2/blog/2005/06/25/an-illustration-of-java-server-proxy

  • How to call a servlet  by  java standalone application

    //program related to calling a servlet by java standalone application and printing the response on console
    import java.io.*;
    import java.util.*;
    import java.lang.Object;
    import java.net.*;
    public class Program
         public static void main(String s[])
         System.out.println("Hello this programm defines about how to call a servlet with a java application ");
         try{
              URL servlet = new URL("http://localhost:8080/anchor/studentform.html");
              URLConnection conn=servlet.openConnection();
              conn.setDoOutput(true);
              InputStreamReader isr=new InputStreamReader(conn.getInputStream());
              BufferedReader br = new BufferedReader(isr);
              String str =br.readLine();
              System.out.println("Source code is" +str);          
         catch(IOException e)
         System.out.println("exception is" +e);
    i am able to read only one line of the form, please help me out to read the whole form (file)

    You are only reading one line? Why aren't you reading the data in a loop? E.g. a while loop. (Keep reading till readLine returns null)
    Kaj

  • How to Call .XDO file From Java Program

    Hi,
    I have developed a report in using BI Publisher version 10.1.3.
    I created the report and it only created XDO files. If I want to call XDO file from Java program how I can do that.
    What are the APIs available to do that.
    Thanks
    -Ashutosh

    Hi,
    the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
    regards
    Rainer

Maybe you are looking for

  • Waveburner and Macbook Pro issue

    Not sure what's going on here but I decided to check a waveburner master on the internal speakers of my 2011 macbook pro. Each song has a distinct pop at the very front if played at the start of the region. It seems like buffers are not being cleared

  • Unusual Time Machine Backup?

    Our small family network consists of three Apple machines: 2003 iMac G4 1.25 GHz  MacOS 10.4.11 & "Classic mode" 9.2 (used as a file server and to run old software) 2012 iMac 2.9 GHz Core i5  MacOS 10.9 2013 MacBook Pro 13-inch w/ Retina Display MacO

  • HT1459 My serial number is coming up not valid

    When I go to registar my IPod Touch and I enter in the serial number given to me on the receipt Apple is telling me that it is an invalid number?!?!?!?!?!

  • Stupid question:  Does Acrobat X1 exist as a standalone product?

    Total Newbie.  Forgive me.  I need Acrobat for a writing project.  I can't seem to find a simple purchase and download option for a basic standalone software package.  I've never run into so many dead ends trying to make a simple purchase. Everything

  • What is the proper method for cleaning up EventWaitHandle?

    Hi all, I'm working on inter-process communication between applications running on the same machine. More specifically I have a primary application that is connected to multiple industrial machines collecting data from each. I want to create secondar