How to update file in Jar using API

Hi,
I have a jar file (actually a war file), and I need to update the properties in one of the files before I deploy it.
I have been able to open it, get the correct JarEntry, load the properties, update the properties, but am struggling to figure out how to save it back to the Jar file?
Any ideas?
cheers,
David

So why isn't your build process just creating thecorrect contents of that properties file
before including it in the war it builds, in thefirst place?
Because we deploy it in many customers. They will
obviously have different ip addresses eg for the
database machine.
Therefore we have certain properties that are
customer-specific we need to update in the war before
we deploy it.
cheers,
DavidI wasn't implying that your build process is only run one time. The build process can be run each time you build for each deployment. So do you mean you only want to deliver one generic WAR to each customer, and you want this change of properties to happen on the customer side somehow? What code are you going to run on that side to change it - not code in your web app because at that point it's too late - you've already loaded the web app and its files, which this/these property files are a part of. Sounds like you need a "build process" to bundle up the app for each unique target.
Alternatively you could investigate adding or altering the manifest file in the WAR (or EAR) file to reference an additional standalone, or loose, directory (outside the WAR/EAR structure) and put your property files there. Then that directory would become part of your app's classpath just like it were in your WAR/EAR, and you could update that file independently.

Similar Messages

  • How to update files in jar?

    Is there any way that I can update a file stored in a jar?

    If I create a temporary file and then replace the
    original one, would the contents of META-INF in the
    original jar (which I want to keep) be replaced too?Yes, you have to rebundle the contents of the META-INF. I didn't knew it still existed, but here is a link to MoaJar:
    http://www.opengroup.org/moajar/tools.zip
    The API handles deleting files, I haven't inspected the source yet, but I think it's working by replacing the original JAR file.
    Greets.

  • How to update the FB01L transaction using the FM  bapi_acc_document_post

    Hi All,
            How to update the FB01L transaction using the bapi_acc_document_post but there is no ledger group field in the bapi function module.
    Please help me how to do it.

    hi,
    use batch input method for the same.
    check this.
    [https://forums.sdn.sap.com/click.jspa?searchID=19107237&messageID=884744]

  • How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE

    Hi guys,
    I posted a question regarding a function module here:
    How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE
    If you have experience about this FM, kindly visit the link and share your wisdom. Thanks.
    Regards,
    Carl

    Hi guys,
    I posted a question regarding a function module here:
    How to update batch (LIPS-CHARG) using FM WS_DELIVERY_UPDATE
    If you have experience about this FM, kindly visit the link and share your wisdom. Thanks.
    Regards,
    Carl

  • How to update java.sql.Clob using javax.persistence.EntityManager?

    Hello.
    Can anyone tell me (or show me some example) how to update java.sql.Clob using javax.persistence.EntityManager.
    When I’m trying to update column (with type Clob) value is not inserting, after update column is empty. I haven’t any error during update, I’m using database Oracle 10g.
    Edited by: ernest211 on Jul 16, 2009 1:24 AM

    Post some code so we can see how you are doing it. If you are using JPA entities take a look at the @Lob annotation.
    m

  • How to update Sales Order status using  BAPI_SALESORDER_CHANGE

    Hi,
    I want to update Sales Order status using BAPI_SALESORDER_CHANGE, this BAPI is called from middle ware, but there is no parameter to pass the status value to this function, please help me how to update sales order status using BAPI only.
    Thanks
    RK

    Hi,
    Can u give me details of what status u would like to update in sales order.
    If we are able to update the status from VA02, Then BAPI will assist for the same.
    Regards.

  • How to update the ztable by using table handling function

    how to update the ztable by using table handling function
    It is very urgent ...............................
    thanks in advance

    see the  below code for the direct   ztable update
    Report  ZUPDATE_PRPS.
    tables: zprps.
    parameter: p_wbs like zprps-pspnr,
               p_value like zprps-fakkz default 'X'.
    data: wa_fakkz type zprps-fakkz.
    *START-OF_SELECTION
    start-of-selection.
    call function 'CONVERSION_EXIT_ABPSP_INPUT'
         exporting
             input     = p_wbs
        importing
             output    = p_wbs
        exceptions
             not_found = 1
             others    = 2.
    select single fakkz
      into wa_fakkz
      from zprps
    where pspnr eq p_wbs.
    if sy-subrc eq 0.
       update zprps set fakkz = p_value where PSPNR eq p_wbs.
       if p_value is initial.
         message i999(za) with 'Billing element field has been unchecked'.
       else.
         message i999(za) with 'Billing element field has been checked'.
       endif.
    else.
      message i999(za) with 'WBS element not found'.
    endif.
    reward  points if it is usefull .....
    Girish

  • How to develop a web browser using API javatv?

    How to develop a web browser using API javatv?
    I'm tryin' to build a web browser using the API javaTv and
    I want to know if that is possible and if somebody already made this.
    This web browser will run a page developed in jsp.
    Thanks.

    You don't need JavaTV to write a web browser.
    Whichever Java platform you're using with JavaTV should provide enough.

  • How to update 500 list items using Rest API

    Hi All,
    i have requirement that is "required to update 500 list items using rest Api".
    how can i do it,please share your thoughts with me.
    Thanks,
    Madhu.

    Didn't get you correctly, if you asking reference for REST API to update list items please refer below links
    http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
    Destin -MCPD: SharePoint Developer 2010, MCTS:SharePoint 2007 Application Development

  • How to save file in km using web dynpro abap

    Hi Experts,
    We have a requirement that file should be saved in a folder in km, the name of the folder should be the employee number.
    Could you please tell me how to create folder with employee number in KM and store file in it using web dynpro abap.
    Thanks and Regards,
    Santhoshi.

    Thanks Naga Raju Meesala.
    How come all these methods are deprecated...getEP5User
    Also, since I am building a weddynpro DC, what is the proper way to include these jar files as Used DCs?
    Now proceed in the same way with the variable PORTAL_HOME and add the following .jar files:
    u2022 \lib\prtapi.jar The portal runtime APIs
    u2022 \portalapps\com.sap.portal.usermanagement\lib\com.sap.security.api.ep5.jar The user management APIs of the Enterprise Portal 5.0 are deprecated, but still in use in SAP NetWeaver 04
    u2022 \portalapps\com.sap.netweaver.bc.rf\lib\bc.rf.framework_api.jar KM Repository Framework APIs
    u2022 \portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urlgenerator_api.jar Repository Framework Utility: URL Generator
    u2022 \portalapps\com.sap.netweaver.bc.sf\lib\bc.sf.framework_api.jar Repository Framework: Repository Services
    u2022 \portalapps\com.sap.netweaver.bc.util\lib\bc.util.public_api.jar Repository Framework Utilities

  • How to list files from .jar file in applet?

    I have created applet and export all files to .jar file.
    I use File.list() method in applet to list files from one directory and that works ok but if I try to do that from web browser it sends exception AccessDenied meaning that File.list() isn't allowed in browser.
    I know what's the problem but I don't know how to solve it.
    What I want is to read from directory list of files.
    Help anyone?

    I will post here my code so that can be seen what I want to do:
    import java.awt.BorderLayout;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URLClassLoader;
    import java.nio.charset.Charset;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.JTextPane;
    public class test extends JApplet {
         private static final long serialVersionUID = 1L;
         private JPanel jContentPane = null;
         private JTextPane jTextPane = null;
          * This is the xxx default constructor
         public test() {
              super();
          * This method initializes this
          * @return void
         public void init() {
              this.setSize(449, 317);
              this.setContentPane(getJContentPane());
          * This method initializes jContentPane
          * @return javax.swing.JPanel
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jContentPane = new JPanel();
                   jContentPane.setLayout(new BorderLayout());
                   jContentPane.add(getJTextPane(), BorderLayout.CENTER);
              return jContentPane;
          * This method initializes jTextPane     
          * @return javax.swing.JTextPane     
         private JTextPane getJTextPane() {
              if (jTextPane == null) {
                   jTextPane = new JTextPane();
              return jTextPane;
         public void start(){
              File fileDir= new File("somedirectory");
              String strFiles[]= fileDir.list();
              String a="";
              for(int i =0;i<strFiles.length;i++){
                   a=a+strFiles;
              this.jTextPane.setText(a);
    Method init() is irelevant, it just adds JTextPane in applet.
    Method start() is relevant, it runs normaly when started from Eclipse but from browser it sends exception AccessDenied.

  • Converting a file to pdf using API

    I am using APIs for converting a word document into pdf file. I added 2 jar files adobe-convertpdf-client and adobe-generatepdf-client in my application and tried to convert a word document into pdf format. For this requirement should i have install livecycle, application server, Database etc. Can it be done using a java console application by using these jar files. If so Can anyone give me a sample code?

    Since cfdocument can render HTML, you may easily convert JPG
    to PDF, using
    <cfdocument format="PDF">
    <img src="myphoto.jpg" alt="my photo">
    </cfdocument>
    However, converting DOC to PDF or PPT to PDF with Coldfusion
    is not currently possible. DOC and PPT have proprietary MS Office
    formatting that is foreign to Coldfusion.

  • IS-RETAIL: How to update custom enhancement field using BAPI?

    Hi gurus,
    Like ECC BAPI: BAPI_MATERIAL_SAVEDATA,
    This BAPI(BAPI_MATERIAL_MAINTAINDATA_RT) is specific for IS-RETAIL to create and update material master data.
    But now If I append one custom field "ZFIELD" to end of table MARA, my question is how to update this custom enhancement field(ZFIELD) using BAPI(BAPI_MATERIAL_MAINTAINDATA_RT)
    Thanks in advance!

    Hi DongHai,
    I suggest you create your own BAPI. Just copy the codes in BAPI_MATERIAL_MAINTAINDATA_RT and add your custom fields. If you want to append the data of the custom field in table MARA, first, you have to create a structure table then goto SE11, type MARA and display. Click the APPEND STRUCTURE then choose the structure that you've created. Hope this will help.
    Rewards if useful
    Regards,
    Mark

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

  • How to create NC data by using API?

    Hi, all
    I want to log NC by using API.  but can't complet succsessful .
    please help me check the following source code.
    thanks.
    NCProductionServiceInterface ncPSI = Services.getService("com.sap.me.nonconformance", "NCProductionService");
    CreateNCRequest ncRequest = new CreateNCRequest();
    //NC500_part: copy from NC500,and ALLOW_PARTIAL=YES
    ncRequest.setActivity("NC500_part");
    ncRequest.setSfcRef(new SFCBOHandle(site, sfc).toString());
    ncRequest.setValidateNCCodeOperation(true);
    // defined NCCODE: NCJPN1
    ncRequest.setNcCodeRef(new NCCodeBOHandle(site,"NCJPN1").toString());
    ncRequest.setDefectCount(new BigDecimal("3"));
    CreateNCResponse ncResponse = ncPSI.createNC(ncRequest);
    DispositionRequest disRequest = new DispositionRequest();
    disRequest.setActivity("NC500_part");  //what can be set for this Activity,  NC500_part is OK?
    disRequest.setSfcRef(new SFCBOHandle(site, sfc).toString());
    ProductionContext productionCtx = new ProductionContext();
    productionCtx.setResourceRef(new ResourceBOHandle(site, "COIL").toString());
    disRequest.setProdCtx(productionCtx);
    DispositionSelection disSelection = new DispositionSelection();
    //DispositionSelection is must need, but what shuold be set?
    disSelection.setXXXX();
    disRequest.setDispositionSelection(disSelection);
    disRequest.setNcCodeRef(new NCCodeBOHandle(site,"NCJPN1").toString());
    disRequest.setTotalDefectCount(new BigDecimal("3"));
    // DispositionNC
    DispositionResponse disResponse = ncPSI.disposition(disRequest);

    I log the nc to my SFC,but how to complete the nc process by API?
    Wait for you help,thanks

Maybe you are looking for