Using standard out for Process.java

hello
I hope I make myself clear with my problem. I want to execute a command using Runtime.exe() on windows. The first step works. I can execute this command:
net stop server
however sometimes the user will be prompted to input 'Y' or 'N' before completion. That means I have to provide this via standard in. This part I cannot get to work. I will attach my code and perhaps someone can enlighten me where I am flawed. Thank you in advance for any help.
     public void closeServer() {
        try
            String[] cmd = new String[3];
            cmd[0] = "cmd.exe" ;
            cmd[1] = "/C" ;
            cmd[2] = "net stop server";
            Runtime rt = Runtime.getRuntime();
            System.out.println("Exec-ing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
            Process proc = rt.exec(cmd);
            // any error message?
            StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");           
            // any output?
            StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
            outputGobbler.setProc(proc);
            // kick them off
            errorGobbler.start();
            outputGobbler.start();
            // any error???
            int exitVal = proc.waitFor();
            System.out.println("ExitValue: " + exitVal);       
        } catch (Throwable t)
            t.printStackTrace();
class StreamGobbler extends Thread
     Process proc;
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
        this.is = is;
        this.type = type;
        proc = null;
    public void setProc(Process proc) {
         this.proc = proc;
    public void run()
        try
            String line=null;
            while ( (line = br.readLine()) != null){
                System.out.println(type + ">" + line);
                 if(type.equals("OUTPUT") && (proc != null)) {
                      if(line != null && line.indexOf("Do you want to continue this operation?") > -1) {
                           OutputStream os = proc.getOutputStream();
                           PrintWriter pw = new PrintWriter(os);
                           pw.println("Y\r\n");
                           pw.flush();
                           System.out.println("wrote Y");
       } catch (IOException ioe)
           ioe.printStackTrace(); 
}As you can see, I assume you get answer back at the appropriate time via the outputstream of the process

Thanks everyone for your quick response,
I have the old ODSs built in 3.5 version which used infosource, update rules and transfer rules.
And they are running for the past 6 months now. And they don't have DTP.
My new ZDSO has got transformation and DTP.
If I use the same Infopack for my both the data target, how will I do a full load for my new DSO. will the existing delta process not get disturbed?
Please advice
Thanks

Similar Messages

  • Can standard workbooks for Process Manufacturing support descriptive Flex?

    Can standard workbooks for Process Manufacturing support descriptive Flexfields in Discoverer 10i??
    I'm not sure if that is so, and I wouldn't want to create views and folders and then realizing that it could've been done in a standrard fashion.
    Can anyone help me please. My email is [email protected]
    Thanks
    Rafael

    Hi,
    The question is too generic. Can be specific with examples?
    To answer your query, every movement of the goods at stage of WIP can be analysed with the conversion costs incurred till that stage using operation wise confirmation in SAP ECC 6.0. IT support required would that of SAP consultants from modules PP, MM and CO.
    Best Regards
    Vimal Vijayan

  • Explain how to use standard LSMW for MM01

    Can anyone explain how to use standard LSMW for MM01 Tcode.pls explain briefly.

    Hi
    Create a project using 0020 as method.
    Max

  • How to use standard APIs for customized services

    Hello,
    I try to use IUserMappingService which has some hard coded paths to services (user mapping service). However sys admin customized the services location and it's impossible to use standard SAP libraries. For example, the standard library has a path:  "com/sapportals/portal/prt/service/usermapping", but a customized path is "com/sap/portal/pdk/srv/usermapping". When I run this iView, I am getting a message: Caused by: java.lang.NoClassDefFoundError: com/sapportals/portal/prt/service/usermapping/IUserMappingService
    Please advise.
    Thanks,
    Yan

    I guess i know what the problem is. How have you given a reference to the UM service in the portalapps.xml file ??
    I think you would have given the reference as "UserMapping". Now the PRT will look for this particular service and in the portalapps.xml of this service the ClassName would be defined as com.sapportals.portal.prt.service.UserMapping, which the PRT is not able to find.
    You can try giving the FQN in the service reference, but i doubt it will work because the PRT will still look for the above class name at the predefined location.
    Regards, Akhilesh

  • Can i use standard workflow for invoice block ? (BUS2081 . WS20000397)

    Hi Experts ,
    Please any one help me to use the standard workflow for Handlinig invoices blocked(T-code MIRO ). 
    I want an email sent , when  PO invoice is posted and blocked with attched PDF format .
    checked Business object BUS2081 . and Workflow WS20000937.
    But not sure how to use . Please help me to used to get the mail using the standard Workflow .
    Thanks .

    HI
    Iam not pretty much sure about MM or Invoices I found one of the [SAP Help documentation|http://help.sap.com/erp2005_ehp_04/helpdata/EN/0e/0e3b0cb84111d3b5b2006094192bbb/frameset.htm] . This might help you to process ahead.
    Regards
    Pavan

  • Create Adobe Form using Design Time for Processes and Forms

    Hi all,
    I am trying to create a form that have 3 fields:
    1. pernr
    2. ename
    3. effective_date
    I done all the necessary setup of BADI ,class, interface and form.
    I need the step to step guide where you create the adobe form using the Design Time for Processes and Forms. Anyone have any idea?
    Edited by: Siong Chao on Jan 3, 2011 4:54 AM
    Edited by: Siong Chao on Jan 3, 2011 5:00 AM

    Hi,
    I couldn't get to your query..
    What do you mean by step by step procedure for a design time & process for forms.
    if you are a beginner and looking for basic examples to implement adobe forms there are lot of them in SDN, please search them.
    let me know if your query was a very specific one.
    Cheers,
    Sai

  • How to use standard Infostructures for SIS Reports

    Now I see many available standard info structures in the infostructures list.Is there any way we can use the standard ones in the repoirts without the need to create infostructures??
    or there any other alternative???

    Sam, actually  SNavaneetha has already answered your question correctly. You don't need to create any new info structures and may use the standard ones. You just need to configure the update according to the business requirements. But since you keep asking about configuring "the reports" I think you might be a bit confused. For the standard info structures we only need to configure the update. Each info structure already has its own report (you'll find them on the SAP menu). If you run MCSI transaction, you won't find any standard info structures on the list because this transaction is for the custom ones.
    You might want to read the documentation, it's not that long and I think the steps are explained rather well:
    http://help.sap.com/saphelp_470/helpdata/en/8c/fd5878a94711d1890a0000e8322f70/frameset.htm
    From "my" document you'll only neeed these steps:
    Assign Update Group at Item/Header Level (p.12)
    Maintain and Assign Statistics Groups (p.13) - no need to create any new groups, use standard 1 and 2
    Then make sure the update is activated in transaction OMO1. Note that the info structures will start to fill in only after you do the configuration. If you need to populate the data from the existing documents, follow the instructions starting on p.32.

  • Using oracle personal for developing java application?

    Can I use Oracle 9i Personal Edition for developing Java applications? Does it provide a JDBC Type 4 driver?
    Thanks a lot.
    [email protected]

    SIR I WANT TO UPLOAD MY DEVELOPER FORMS BY USING ORACLE 8I SERVER?
    CAN U TELL ME THE PROCEDURE IN DETAIL?
    I WILL BE THANKFUL TO U
    MY EMAIL ADDRESS IS [email protected]

  • Working on LSMW using IDoc method for processing Open Sales Orders

    We are currently in middle of creation of a new instance of production for a different Business SBU. We are looking to utilise the LSMW tool using IDocs for uploading / transferring the open orders to the new box. If some one has worked on LSMW using IDocs, please get in touch and if you could share any documents on the process of utilising the LSMW tool using Idocs for any kind of conversions, it would be great. The following is a sample case.
    1. Each order will have multiple segments with different qualifiers under various segments.
    2. Multiple line items would be available under each order.
    Issues we are currently looking to solve :
    1. How do you manage to loop through the qualifiers during processing for the same segment.
    2. How do you prepare the tool to recognise the multiple line items of the same order.
    3. What kind of strategy needs to be used to create the input data file(s). Like, splitting the header and detail level information ?
    Note  : The volume of data we are looking at is somewhere around 40-60 thousand orders worldwide.
    Thanks in Advance.

    hI vikram check this link
    and reward points if helpful
    http://www.****************/Tutorials/LSMW/IDocMethod/IDocMethod1.htm
    http://www.jt77.com/system-dynamics/model-01395.html

  • Time-Out for Process with Correlation - Avoiding blocked Queues

    Hello,
    I have the following requirement, it would be great if you could share your opinions and knowledge on it:
    If have an integration process which opens a correlation and sends out an asynchronous request message. The response normally arrives after 10 minutes and is correlated to the process using a correlationID that has been activated by the request message. Additionally there is a deadline branch which terminates the process after 1 hour.
    So far this works fine.
    However there might be some very rare cases where a response is delayed (e.g. if there is maintenace work on partner side). So it could be the case that a response arrives a day later when the process instance is already terminated:
    My questions are now:
    1. How can I avoid that the inbound queue is blocked with the response message that cannot find an active correlation?
    2. Best thing would be to store the response message on the file system in case no more active correlations are open.
    So basically the logic could be:
    If message arrives, check whether process instance with corresponding correlation is active, if yes then send to process, if no send to file receiver.
    Is this possible?

    Thread closed - no solution so far.

  • Using change pointers for Process orders

    Hi Experts,
    We have a requirement where we need to send idocs when a process order is changed. Since process order data is a transactional data, can we still use change pointers?
    We tried using the message type LOIPRO and it is giving an error saying that this message type cannot be sent with change pointers.
    Can anyone guide me with the process and steps to get this done?
    Thanks.

    For change pointer, you would have to deligate the business object with t.code SWO1. To handle it, it would take too much time to explaint.
    If you use the BAdI, and call function in this way : "  CALL FUNCTION 'FUNCTION_NAME' IN BACKGROUND TASK AS SEPARATE UNIT EXPORTING ....." the function would executed only after commit (when you call the funtion, it holds in a queue for commit. In roll back, it get disapeared).
    User method in_update from the BAdI.
    Edited by: Lior Tabib on Oct 19, 2010 4:18 PM
    Edited by: Lior Tabib on Oct 22, 2010 7:27 PM

  • Use of BPM for processing XML message

    I have got a requirement for updating X-number and X- status into the SAP system from a non SAP system. I am getting the message which contains both these values in the form of xml and using HTTP and should be posted as 2 different IDOCs at the SAP system.
    But the requirement is to post the X-number first and once it is updated X-status should be posted based on the number.
    Assuming that X-number is available first and the status next in the non SAP system can we use BPM and if so how what needs to be done to make sure status doesnt update before number.

    Hi,
    Proceed as follows:
    1) Receive the X-message
    2) have  a transformation step....and map only the x-number into the target IDOC
    3) have a synchronous send step....why a sync send....because in that you can get the confirmation for success/failure of your x-number upload....this is only if you want a confirmation...this will make sure that your x-number is updated first.....
    4) now if you do not want to have a response back then...have a transformation step to map the x-status to your IDOC...then have a async send step...
    5)
    a)If sync send used: then you can have a condition like check the status of upload of x-number and if successful then send the x-status.
    b) if failure then you can resend the x-number message.
    c) if async send then you can directly send your x-status message.
    Steps 3, 5(a), 5(b) can be avoided if async commn is used. If you want that your BPM runs somewhat faster then you can avoid the transformation steps....instead you can use the mappings in the respective interface detemination.
    Regards,
    Abhishek.

  • Using SAP Calendar for Process chains

    Hi Everyone,
    Is there a way to schedule the daily process chains to run from Monday to Saturdays
    We do not want to run them on Sundays or holidays. Holidays here will be defined by us.
    So does factory calendar do the job?
    Can we change the holidays in Factory calendar?
    Any insights here will be very helpful.
    Thankx
    Kumar.

    Hi.......
    You can do it in the following way........
    You create a job in SM36 >> Here in the first screen give the job name >> then click on Start condition>> there click on Date/time >> give Scheduled start date and time>> Then click on Restrictions tab ( beside periodic values) >> There give the Factory Calender id and select Do not execute jobs on Sundays or holidays >> then click on Peridic values and select Weekly >> create this job using the program : BTC_EVENT_RAISE..........and in its variant maintion the event(but before that create this event in SM62)
    This job will give trigger this event.............maintain this event in the start condition of the process chain...............
    Then this chain will not run on Sundays.........
    Or you can directly do it in the Start variant of your Process chain.................Click on Restrict and make the settings.......
    Hope this helps you......
    Regards,
    Debjani.......
    Edited by: Debjani  Mukherjee on Sep 30, 2008 9:40 PM
    Edited by: Debjani  Mukherjee on Sep 30, 2008 9:46 PM
    Edited by: Debjani  Mukherjee on Sep 30, 2008 9:58 PM
    Edited by: Debjani  Mukherjee on Sep 30, 2008 10:14 PM

  • Using separate JVM for a java program, other than what's installed in OS

    Hello all,
    I am trying to use different version of java executable , other than using the version of java installed in the OS, in the windows.
    Is linux, I believe I have used different version of java ( I suppose using different JVM ? )
    Would there be any conflict between the version of java installed in the computer and the version of java in my program ?
    Thanks
    Kyle

    venvidu wrote:
    I see,
    So, each java executable from the separate version is its own JVM + executable java code and different java executable can be run at the same time. I don't know what you mean by that. You start a new JVM when you start java.exe or javaw.exe (on windows), and you can have several VMs running, both of same version, and of different versions.
    >
    Then, in the windows OS, is there anything in the system file which store specific information about the installed java version ?The registry has some information, but a VM doesn't need to write anything to the registry, so it all depends on how you installed the VM.
    >
    The idea is that, on top of the installed version of java, I am trying to included pre-compiled java in my program. Huh? I don't understand that.
    So that my program uses its own java version Ok
    -- most likely, the latest version Why do you think so? You can release your software today with a JRE, but that JRE might not be the latest version 1 week later.
    -- regardless of what the current windows OS has.
    I know this poses no problem in the linux OS, but is there anything in the windows OS that might potentially corrupt the above approach ?I'm not sure that I have understood exactly what you said, but I don't see any problems.
    Kaj

  • How to use copy of standard program for direct input in LSMW

    currently we're using object 0085 Purchase Orders and and method 0001 for standard direct input, which is processed with program RM06EEI0
    now I want to set an additional flag and avoid creating it by means of BUS PurchaseOrder.CreateFromData1 method (coz the structure is quite different and more complex).
    so my question is now how can i assign a copy of the standard program for processing?
    for better understanding I've attached a screenshot of the according screen
    [img]http://img71.imageshack.us/img71/1558/lsmwcr6.jpg[/img]

    ok, solution was to maintain table SXDA1 (SAPDXfer: Data Transfer Objects and Sub-Category).
    modify entries for DXPRG, DXPR1 and LOADPRG with custom program names

Maybe you are looking for

  • ESS in MSS

    Hi All, We are having problem with team viewer iView from ESS in MSS workset and want to display 'book  training courses' iview for all or individual employees.When team viewer selected and getting following error like" <b>No objects found</b>" eithe

  • How can I create a slideshow

    I want to create a slideshow. The help section of Flash 8 on this topic is confusion. Where can I find instructions on how to create slideshows. Also, I would like to know how to incorporate slideshows to webpages using Dreamweaver 8. Any help would

  • Bug in cursor behaviour with duplicates

    Dear Oracle guys and girls, first of all: it sucks that i HAVE to provide business information (company name, address, even phone number) even if i just want to participate in this forum for private reasons. I even have to "unsubscribe" to the newsle

  • No disc available at opening FCE

    Hello, every time I open FCE i get a message telling me i have no access to the chosen disc, HD Mac, no reading or writing. When I verify i can see that the audio import is not active, which i cannot change. can you please give me a solution, because

  • Which application server is requierd for form9i and for form10g

    which application server is requierd for form9i and for form10g