How to modify build.xml ant to invoke a static init method when building?

Hello,
I´d like to make it as such that when I select to build and clean project in netbeans it calls a specific static init method in one of the project classes (which actually generates the database file). //for that purpose that code is only needed there. Is it possible?

hi.. please help me with this problem...
i need to execute tomcat server using my ant build file... but how can i do that if the tomcat server is located in other PC... i tried the exec task, but it seems to be not enough... the server doesn't run on the other pc but my it seems fine on my console.
by the way, here's my code...
<target name="run_tomcat">
<exec dir="${src.dir}" executable="cmd">
<arg line="/c startup.bat" />
</exec>
<echo message="tomcat successfully running!!!"/>
</target>
my src.dir has value in the properties file which contains the mapped directory. please tell me.. is it really possible to run a program in other PC using my build file in my PC...
please....please....please....please.... heeeelllpppp!!!!
tnx a lot!!!!

Similar Messages

  • How to modify the xml file

    Hi
    i am able to parse and modify the xml using DOM parser
    after ever modification I am using the below code to write in the file
    org.apache.xml.serialize.OutputFormat format = new org.apache.xml.serialize.OutputFormat(doc);
              format.setIndenting(true);
              org.apache.xml.serialize.XMLSerializer output = new org.apache.xml.serialize.XMLSerializer(new FileOutputStream(xmlFile), format);
              output.serialize(doc);
    using the above code I am overwriting the entire xmlFile
    is there an function that change only the required node the xml that change should me reflected in to the xml file
    thanks in advance

    YoungWinston wrote:
    chi8088 wrote:
    is there an function that change only the required node the xml that change should me reflected in to the xml fileI'm pretty sure there is, but I'm afraid I'm not a DOM expert.No, there is not. An XML file is really at its heart just a text file, and just like you can't simply write a change in the middle of a text file* but rather have to re-write out the entire contents, the same is true for an XML file.
    * unless you use a RandomAccessFile, and know the exact position to seek, and the change doesn't cause the rest of the contents to shift, such as by adding more content or removing some. All of which are very restrictive conditions.

  • How to Modify Server.xml and web.xml inTomcat

    Hii
    i am very new to tomcat..and using servlets..so plx tell me hw i can modify the server.xml and web.xml....
    if my installables are in c:\program files\apache group\tomcat4.1
    ok...i have my servlets file in c:\program files\apache group\tomcat4.1\webapps\ap1\WEB-INF\classes..so plz advice me on modifying the server.xml and web.xml....also tell me how and what we do in mapping
    Plz tell me soon...
    thanking u in advance.
    rahul
    Take care.:)

    for web.xml you need something like this, i took this from the web.xml under the examples directory in tomcat:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>
    servletToJsp
    </servlet-name>
    <servlet-class>
    servletToJsp
    </servlet-class>
    </servlet>
    <servlet>
    <servlet-name>
    CompressionFilterTestServlet
    </servlet-name>
    <servlet-class>
    compressionFilters.CompressionFilterTestServlet
    </servlet-class>
    </servlet>
    </web-app>
    basically you need to map the servlet with a class, for servlet-name call it whatever you like, you'll be using this name in the url to access you servlet, for the class give it the name of the class, java complied class, that's it.
    server.xml is used to configure tomcat.

  • How to modify an XML values using XSLT and Java

    Hi Friends,
    I wish to modify a simple xml to another xml using XSLT, please let me know what are the things i need to know to convert the XML to another XML.
    If somebody can give a sample code, it will be great...
    I wish to do the following sample conversion of XML
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST1</NAME>
    </ROOT>so that the results look like below....
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <ROOT>
    <NAME>TEST2</NAME>
    </ROOT>Notice TEST1 is replaced with TEST2 in the 2nd XML, I wish to get that result...please help.
    Thanks and Regards,
    JG

    Thanks for your nice reply... do you have a sample code...

  • How to modify a xml file?

    I use JAXP 1.1 to read a xml file as a DOM tree. I can make change to the DOM tree in the memory, such as add an element or change the node value, but how can I apply these changes to the source xml file, i.e., write the changes back to the disk?

    you can write an xml file using DOMWriter.
    copy and compile this class
    and then use it:
    PrintWriter printWriter = //create a printWriter form your xml file
    DOMWriter writer = new DOMWriter(printWriter);
    writer.print(myXml.toString());
    package Zeus.core.XML;
    import java.io.*;
    import org.w3c.dom.*;
    * @author Rodrigo Gonzalez Asensio
    * @email [email protected]
    public class DOMWriter {
       protected PrintWriter out;
       protected boolean canonical;
       protected String encoding;
    public DOMWriter(OutputStreamWriter out) throws UnsupportedEncodingException {
         this(out, false);
    public DOMWriter(OutputStreamWriter out, boolean canonical)
         throws UnsupportedEncodingException {
         encoding = out.getEncoding();
         if (encoding == null) {
              throw new UnsupportedEncodingException(out.getEncoding());
         this.out = new PrintWriter(out);
         this.canonical = canonical;
    /** Normalizes the given string. */
    protected String normalize(String s) {
         StringBuffer str = new StringBuffer();
         int len = (s != null) ? s.length() : 0;
         for (int i = 0; i < len; i++) {
              char ch = s.charAt(i);
              switch (ch) {
                   case '<' :
                             str.append("<");
                             break;
                   case '>' :
                             str.append(">");
                             break;
                   case '&' :
                             str.append("&");
                             break;
                   case '"' :
                             str.append(""");
                             break;
                   case '\r' :
                   case '\n' :
                             if (canonical) {
                                  str.append("&#");
                                  str.append(Integer.toString(ch));
                                  str.append(';');
                                  break;
                             // else, default append char
                   default :
                             str.append(ch);
         return (str.toString());
    public void print(Node node) {
         // is there anything to do?
         if (node == null) {
              return;
         int type = node.getNodeType();
         switch (type) {
              // print document
              case Node.DOCUMENT_NODE :
                        if (!canonical) {
                             out.println("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>");
                        print(((Document) node).getDocumentElement());
                        out.flush();
                        break;
                   // print element with attributes
              case Node.ELEMENT_NODE :
                        out.print('<');
                        out.print(node.getNodeName());
                        Attr attrs[] = sortAttributes(node.getAttributes());
                        for (int i = 0; i < attrs.length; i++) {
                             Attr attr = attrs;
                             out.print(' ');
                             out.print(attr.getNodeName());
                             out.print("=\"");
                             out.print(normalize(attr.getNodeValue()));
                             out.print('"');
                        out.print('>');
                        NodeList children = node.getChildNodes();
                        if (children != null) {
                             int len = children.getLength();
                             for (int i = 0; i < len; i++) {
                                  print(children.item(i));
                        break;
                   // handle entity reference nodes
              case Node.ENTITY_REFERENCE_NODE :
                        if (canonical) {
                             NodeList children = node.getChildNodes();
                             if (children != null) {
                                  int len = children.getLength();
                                  for (int i = 0; i < len; i++) {
                                       print(children.item(i));
                        } else {
                             out.print('&');
                             out.print(node.getNodeName());
                             out.print(';');
                        break;
                   // print cdata sections
              case Node.CDATA_SECTION_NODE :
                        if (canonical) {
                             out.print(normalize(node.getNodeValue()));
                        } else {
                             out.print("<![CDATA[");
                             out.print(node.getNodeValue());
                             out.print("]]>");
                        break;
                   // print text
              case Node.TEXT_NODE :
                        out.print(normalize(node.getNodeValue()));
                        break;
                   // print processing instruction
              case Node.PROCESSING_INSTRUCTION_NODE :
                        out.print("<?");
                        out.print(node.getNodeName());
                        String data = node.getNodeValue();
                        if (data != null && data.length() > 0) {
                             out.print(' ');
                             out.print(data);
                        out.print("?>");
                        break;
         if (type == Node.ELEMENT_NODE) {
              out.print("</");
              out.print(node.getNodeName());
              out.print('>');
         out.print("\n");
         out.flush();
    } // print(Node)
    * Returns a sorted list of attributes
    protected Attr[] sortAttributes(NamedNodeMap attrs) {
         int len = (attrs != null) ? attrs.getLength() : 0;
         Attr array[] = new Attr[len];
         for (int i = 0; i < len; i++) {
              array[i] = (Attr) attrs.item(i);
         for (int i = 0; i < len - 1; i++) {
              String name = array[i].getNodeName();
              int index = i;
              for (int j = i + 1; j < len; j++) {
                   String curName = array[j].getNodeName();
                   if (curName.compareTo(name) < 0) {
                        name = curName;
                        index = j;
              if (index != i) {
                   Attr temp = array[i];
                   array[i] = array[index];
                   array[index] = temp;
         return (array);
    regards.

  • How to modify web.xml init parameters?

    Hi all!
    I need to modify my application's init parameters on the fly.
    I think that if i can get those parameter through FacesContext, then i should can set them too.
    Anybody knows if it is possible ou how to do it?
    Thanks,
    Cezar

    Hi all!
    I need to modify my application's init parameters on the fly.
    I think that if i can get those parameter through FacesContext, then i should can set them too.
    Anybody knows if it is possible ou how to do it?
    Thanks,
    Cezar

  • How to modify Source XML Structure as it is getting Fail in message Mapping

    From Client , I am Gettin Such XML Structure in XML File ...But it is getting failed in Message Mapping ,.,,
    <?xml version="1.0"?>
    <invoice>
       <Header>
          <DOCID>0001</DOCID>
          <DOCNO>0001</DOCNO>
          <INVAMT>1000</INVAMT>
       </Header>
    </invoice>
    I tried to find out few things ...
    On test of mesage mapping
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:invoice xmlns:ns0="urn:sample.com:file:file">
       <Header>
          <DOCID>0001</DOCID>
          <DOCNO>0001</DOCNO>
          <INVAMT>1000</INVAMT>
       </Header>
    </ns0:invoice>
    This mapping is getting successful.
    So Problem I found Is difference in Sender File Structure from autogenrated Source Structure in Test tab :  
    </invoice>
    and
    <ns0:invoice xmlns:ns0="urn:sample.com.com:Invoice:DB">
    Please Suggest : What to do ?
    How to add this ns0: before INVOICE and :ns0="urn:sample.com.com:Invoice:DB" after INVOICE in Source Structure.
    I am using PI 7.0
    regards
    Prabhat

    Hi Prabhat,
    the easiest way is to make the field XML Namespace of the source Message Type blank.
    Regards,
    Udo

  • How to customize the XML file name from user entered field value when submitting

    How can I customize the name of an HTTP submitted XML file from data entered by the user in a text field?
    The field in question contains user identification information and would ease the sorting of files received for easy identification.
    Thank you,

    How can I customize the name of an HTTP submitted XML file from data entered by the user in a text field?
    The field in question contains user identification information and would ease the sorting of files received for easy identification.
    Thank you,

  • How to parse a XML stream sent to servlet with PUT method

    Hi,
    I have to interface my servlet app with other apps communicating with XML.
    This way, My servlet will receive a XML stream in the http request, parse it and send back a XML message.
    What I've done is :
    An html page to send a XML File with a put method :
    <form enctype="multipart/form-data" method="PUT" action="http://localhost:8080/MyApp/servlet/TestUploadServlet">
         <input type="file" size="20" name="FileToUpload" value="Select File">
         <input type="submit" name="UploadFile" value="Upload">
         <input type="reset" value="Reset">
    </form>
    A servlet TestUploadServlet with :
    SAXParser parser = new SAXParser( );
    Trace.traceLine( "SAXParser" );
    parser.setContentHandler (this);
    try {
    parser.parse( new InputSource( requete.getInputStream() ) );
    catch (SAXException e) {
    Trace.traceLine( e.getMessage() );
    catch (IOException e) {
    Trace.traceLine( e.getMessage() );
    and the methods startElement, stopElement and other to work with the elements detected by the parser (already used by other programs parsing local xml files).
    And it doesn't work.
    is the html code is a good way to send a file in the http Put method ?
    is the parser.parse( new InputSource( requete.getInputStream() ) ); a good method to read the stream ?
    please help.

    I think the problemn comes from the method used to send the <XML> stream.
    Using an html form doesn't seem to be a good method.
    I tried several methods or examples found and none of them seems to work.
    here is another example in the servlet side :
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream output = res.getOutputStream();
    output.println("ContentType: " + req.getContentType() + "<BR>");
    int content_length = req.getContentLength();
    output.println("ContentLength: " + content_length + "<BR>");
    if(content_length > 0) {
    output.println("Content: ");
    ServletInputStream input = req.getInputStream();
    byte [] buffer = new byte[1024];
    int nb;
    while((nb=input.read(buffer))!= -1) {
    output.write(buffer,0,nb);
    Can somebody tell me how to write a java code sending a http request with the content of a file in the content of the request ?

  • Adding environment variable in build.xml(ANT)

    Hi,
    I need some information Regarding ANT,
    the problem is i have to add a property file in build.xml (as a environment varialble) so that i can read it in my java code. as
    System.getProperty("").
    Please sugggest me how to set environment variable in build.xml(ANT)
    Thanks
    Edited by: fdfddf on Apr 7, 2008 3:20 PM

    Hi Jakain, yep thanks for your information but my manager wants that way to do..
    he wanted me to set property file as a environment file using build.xml as this property file changes dynamically..
    can you suggest me

  • How to write a Xml installation file to build  web installer using IzPack.

    Hai everyone,
    I have got a problem in building a web installer using IzPack.I am getting this exception,when I am compiling my install.xml using a compile tool provided by IzPack soft.Eventhough I have not mentioned "packsinfo.xml" in my Xml installation file.
    Fatal error :
    null\packsinfo.xml (The system cannot find the path specified)
    java.io.FileNotFoundException: null\packsinfo.xml (The system cannot find the path specified)
    What went wrong??
    It is very very urgent. Could anyone tell me how to write a Xml installation file for building web installer,please??
    any help will be highly appreciated....
    Thank you very much in advance

    Hi,
    that is not really a java related question. Have you tried to find some IzPack support forum? I've never heard about it, so I can't help.

  • How to modify Data Template  ARXSGPO.xml

    We are on EBS 12.1.1. My client want to customize AR Customer Balance Statement Letter. They need rtf to be modified as well as some additional info for which I need to modify Data Template ARXSGPO.xml .
    But I am not able to modify above xml file. Update File button has been disabled. Could someone tell me how I can update existing xml file ?
    Thanks in Advance

    Hi
    You could use the XDOLoader command to upload data templates.
    http://bipublisher.blogspot.com/2008/01/bi-publisher-xdo-loader.html
    But it would be better if you could create a custom report and attach the new date template, instead of modifying the standard report.
    Regards
    Nishka

  • [svn] 3140: Modifying build. xml to include templates in the jar from the new location.

    Revision: 3140
    Author: [email protected]
    Date: 2008-09-08 09:04:17 -0700 (Mon, 08 Sep 2008)
    Log Message:
    Modifying build.xml to include templates in the jar from the new location.
    Modified Paths:
    flex/sdk/trunk/modules/antTasks/build.xml

    Don't be so impatient and don't multipost! I've deleted your other thread about the same topic.

  • How to find and modify underlying XML Template for a OA Framework page

    Env: R12
    There is a standard OA Framework page in Purchasing that can be reached by
    Purchasing Manager > Buyer Work Center > Orders > Search for a specific PO > Open the PO Page
    Then Open the PO Details page for what you searched
    Now in the PO Details Page, On the right hand top corner is a drop down list for Actions > View PDF
    This generates a PDF output of the PO, PO Details and the terms and conditions.
    I want to modify this pdf. ( Change the template and add/remove a few columns)
    I believe that this is an XML Pub report running in the background but how to find out what report is running and how to modify its template ??
    Thanks
    Gabbar

    Hi Gabbar,
    Click on 'About this Page' and figure out the page, controller, AM and VOs. You can download these xml and class files from JAVA_TOP. Page can be downloaded from mds directory under PRODUCT_TOP.
    Regards

  • How to modify XML to copy items

    Hi,
    i need to copy from itemcode "XX" to itemcode "YY". i save it with XML as:
    Dim oBI As SAPbobsCOM.Items
    oBI = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
    oBI.SaveXML(sFileXml)
    I need to modify XML because i must change ItemCode and then add the new item
    <ItemCode>XX</ItemCode>
    ???<ItemCode>YY</ItemCode>
    How can i do this?
    Thanks
    Valentina

    I am trying to do the exact same thing right now.  I am having moderate success with oItem.GetAsXML into a string, then using REPLACE to change the itemcode value (it exists in about 18 places, for me, because the XML gives you other stuff, like the contents of OITW).
    Then I just write my string to a temp file and bring it back in to the new object and do the add.  Here's my code:
               tempXML = System.IO.Path.GetTempFileName()
                'retrieve template item object's xml into string
                itemObjectXML = zTmpltItm.GetAsXML
                'replace the template item code with the new one
                itemObjectXML = Replace(itemObjectXML, String.Format(ItemCodeXML, zTmpltItm.ItemCode), _
                                String.Format(ItemCodeXML, zNewCode))
                'replace the template item code with the new one          
              itemObjectXML = Replace(itemObjectXML, String.Format(ItemNameXML, zTmpltItm.ItemName), _
                    String.Format(ItemNameXML, zNewName))
             'some other code...
                'save the template to disk
                sw = New System.IO.StreamWriter(tempXML, False)
                sw.WriteLine(itemObjectXML)
                sw.Close()
                'retrieve the new item's xml into a new item object for adding to the DB
                oNewItem = oCompany.GetBusinessObjectFromXML(tempXML, 0)
                'oNewItem.ItemCode = zNewCode
                'oNewItem.ItemName = zNewName
                retval = oNewItem.Add
                If retval <> 0 Then
    The one thing I wonder about is how large can the XML string end up being.  I think .net has a 32K limit, but the GetAsXML function does return a string.
    I'm doing this in 2007 and I have a problem with some of the values returned, however (like the SHGHT1Unit field).  I have a separate post for that one.
    I don't know if my way is "best practice" or even advisable, but I do have it working.
    PS: you've got to have this statement before doing the xml copying:
    oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode
    Added a PS
    Message was edited by: JC
            John Chadwick

Maybe you are looking for

  • Outbound IDOC WPDTAX  not getting generated

    Hi I am not  able to generate outbound IDOC WPDTAX through WPMA transaction. We are using TAXUSJ as the tax procedure. Tax Condition type UTXJ and JR1 has been maintained in the system. On looking at the code against WPMA , POS_TAX_GET is called to c

  • My resolution of Apple wireless keyboard failure.

    I’ve seen a lot of posts on this Forum pertaining to wireless keyboard disconnect problems. There are many, many suggestions for how to resolve (rebooting, removing plists, updating firmware, suspicions about Leopard, disconnecting all USB devices, e

  • Mail stops shutdown

    Hi I have recently switched from Outlook 2011 to Mail for email management.  I am running OSX 10.8.4. and Mail 6.5 I am finding that frequently, when I go to shot down the macBook Pro, Mail is not c losing down and stopping the shut down, and I have

  • Need complete Configuration steps for creating Shipment & Shipment costs.

    Hi, Can anybody explain the Configuration steps in IMG required to create Shipment (T Code - VT01) & Shipment costs (VI01). Thanks in advance. Manjunath.

  • After updating to ios5 my previously purchased ring tones don't work.

    After updating to ios 5 my ring tones show only the default ones on my phone.  In Itunes it shows up, I have synced a number of times but the ring tone never shows up on the phone.