How would you capture the stdout of Runtime.getRuntime().exec())?

How would you capture the stdout of Runtime.getRuntime().exec())?
Say you wanted to execute PKZIP25.exe from java using Runtime.getRuntime().exec(). How would you capture the output of PKZIP25 (the console IO) in a file so you could check the results?
Thanks
Bill Blalock

Thanks.
Could you explain a little more?
The program I am calling seems to be executing, as far as Java is concerned, but nothing happens. I imagine I have made mistakes in calling it but can't see the output to the console.
Should I use Runtime.getRuntime().exec() or Runtime.exec() for something like this?
I appreciate the help!
Bill B.

Similar Messages

  • How would you change the state to the base state?

    How would you change the state to the base state? Its not
    letting me do something like:
    currentState='<Base State>';

    Sorry about the vagueness of that last reply :)
    What I have done now in my code is this:
    viewstack1.addChildAt(loginCanvas,0);
    toggle.selectedIndex = 0;
    However nothing happens at this line of code:
    toggle.selectedIndex = 0;
    but this works:
    toggle.selectedIndex = 1; or ...
    toggle.selectedIndex = 2;
    toggle.selectedIndex = 3;
    toggle.selectedIndex = 4;
    toggle.selectedIndex = 5;
    toggle.selectedIndex = 6;
    The strange thing is that if I have a button on the screen:
    <mx:Button x="10" y="3" label="Button"
    click="toggle.selectedIndex =0"/>
    and the user clicks it the toggle.selectedIndex = 0; works.
    I'm stumped, any ideas?

  • How would you rate the iTouch as a gaming device?

    On a scale of 1-10, how would you rate the iTouch as a gaming device?

    7, if the game is well designed for iPod touch is very good!
    let the last three pionts be left to the iPad

  • How would you change the default template?

    How would you change the default template?

    Hi,
    what do you mean by changing the default template? Do you want to change the standard BEx web template for all web applications? This can and should be done with transaction SPRO, there you can change it to your own (maybe by copying the standard template and fitting it to your needs).
    With regards,
    Daniel

  • How would you describe the function of 'Camera roll'?

    How would you describe the function of 'Camera roll'?

    ITs the folder that stores pictures taken with the camera or downloaded from the web.   Or stored from Apps running on the iPad.
    Basically any picture or image created on the iPad will reside in there.

  • How would you optimize the dimensions?

    How would you optimize the dimensions?

    HI Vsu,
    The basic way of optmizing the Dimensions would be to have similar kind of objects into that dimensions. For example having the Customer related infoobjects into the customer dimension will obviously help in optimized data retrieval performance.
    There could be some scenarious where U can optimize the Dimension by dividing the Dimension Data into Line Item Dimension. By this way U would divide the load of data onto the Dimension and the cube, hence again optimizing the performance.
    Hope this helps U. U can be graceful by assinging points.
    Regards,
    Syed.

  • How would you determine the total ram used by applets?

    hi guys;
    I have 2 applets.
    One applet runs in a browswer. - in the microsoft jvm.
    Another applet on another browser (or another page) - in the sun plugin.
    How would you guys determine the total RAM (not just heap memory) used by these applets.
    my strategy would be to open up the browser. and look at the memory next to that internet explorer process. Then I would open up another browser with applet and see total memory taken. Then I would subtract to determine the difference.
    Does this sound correct?
    Each applet has multiple jar files associated with it.
    Stev

    What you really should do is test your applet on a bunch of machines, like a 32 meg ram win 98, 64 meg ram win NT, and a 256 meg ram win 2000, and then give them a performance report under the different configurations. That's really what they're after (probably)

  • How would you find the pitch period of a sound signal?

    Hi
    I have a few questions and i would like if somebody could help me even with the smallest comment on this.
    How would someone be successfully estimate the pitch period (fundamental frequency) of a 5 second sound file?How would you successfully distinguish the voiced from the unvoiced parts and how would you make sure you dont mix voiced/unvoiced sections? Finally how can you find the exact points where the pitch is at its peak throughout the signal?
    Any help/comment/suggesion would be much appreciated

    Hello Madgreek,
    After some thought I think I may have come up with an algorithm for what we have discussed. Basically, you are interested in knowing the time intervals over which you can observe any given frequency in your signal. As you had suggested, you can examine small windows of your signal and perform FFTs on each of the small windows to determine what frequency content is contained in that window. By examining all of the windows, you will see when particular frequencies are prevalent in the original signal. You'd want to use the smallest allowable window to give you the most resolution, but one that is large enough to cover an entire period of the lowest frequency (so that you don't miss this frequency).
    I have attached an example program that performs this operation. The example performs this analysis on an array that represents audio data. I am basically performing multiple FFTs (for each window) and stacking these FFTs in time to form a 3D plot. By examining the 3D plot, I can then see when in time my frequencies of interest are at their peaks. Rather than graphing these plots, you may work out a different algorithm for programmatically determining and logging these peaks and times. I hope this is what you were looking for!
    Attachments:
    Time Variable FFT.vi ‏250 KB

  • How do you capture the screen?

    How do i capture the screen?
    i guess this is it to this question...
    thanks

    yep, dats wat i meant
    is there a way to capture only one window? or should
    I just cut the unnecessary part myself?On windows:
    You can use "alt + print scrn" to only get a screen shot of the window that has focus.
    /Kaj

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • How would you capture AIR audio on iOS (inside ANE)?

    Hi! I'm wondering what would be the best way to capture AIR app audio on iOS.
    I was able to capture video with OpenGL(that was tricky), also I'm able to do microphone capturing, both from ANE.
    Now I'm wondering how does AIR do audio output on the native level (iOS). What API does it use... From that I might be able to understand how to capture the audio. I know that there are different audio "pathways" from my limited iOS understanding, like Remote IO, or AVFoundation - but I'm not sure how/if its possible to capture from AVFoundation if its that. I know there's a way to capture from Remote IO.
    In general, I know it is possible, I'm seeing frameworks being able to capture audio on iOS just with a single ANE...so its only about figuring out "how".
    To clarify: I'm looking to capture realtime audio output from an AIR app.

    I'm trying the log and transfer method with Pro Res 422 HQ at the moment from material from a Panasonic SD5. For some reason FCP cannot mix down the 5:1 sound properly and you get channel 1 being 5 times as loud as channel 2. HOWEVER using Clip Wrap and again transcoding to Pro Res 422 HQ, seems to be able to mix the 5:1 to stereo, perfectly.My problem is Catch 22, I am often told to film in nasty places hence the need for tiny AVCHD cameras. Other programmes can work with these files like Pinnacle and FCE, however they do not have the Pro Res 422 HQ codec for exporting, that I must deleiver on, so I am having to work with FCP.Looks like Clip Wrap seems to work quite well....so far, but I haven't tested it properly yet.

  • How would you solve the following Synch Async scenario?

    Hi,
    I have the following use case and would like to know thoughts from the community on how to solve it -
    There is a web based portal sending a create order request to ESB and the ESB does some message processing and passes it to a CRM to complete the order processing and generate a order id to be sent back to the portal user.
    Non Functional Requirements -
    1) Reliability
    2) Performance in terms of response time to the user.
    Issues -
    1) The web service exposed by CRM takes a long time to process the request and it is not acceptable that the Portal end user waits for that long to get the Order ID back..
    2) If we make a SOAP/HTTP call from Portal --> ESB and then another SOAP/HTTP call from ESB ---> CRM then the reliability is compromised.
    Solution -
    The solution that we are proposing is as follows -
    1) Make a SOAP/HTTP call from Portal to ESB and then put the message in a JMS Queue which will persist it. This will provide reliability and QOS.
    2) Generate a random unique number (which will act as the order id for the user) inside the ESB and send it back to the user immediately after persisting the message in the queue. Also persist this interim order id in a database.
    3) Pick the message from the queue using MDB or Proxy service (specific to Oracle Service Bus because that is what we have as an ESB) and send the message to CRM.
    4) CRM takes its own time to process the request from MDB and sends the response (actual OrderID in CRM) which is then persisted corresponding to the row in step#2. Thus for future search by the user we can use this mapping to get the actual order details from CRM.
    I do not see this as a scenario which is unique or unusual, where an Asynch request needs to made to look as synch to the user. But the solution we are proposing seems to be crude to me and with loopholes (like how to handle scenarios where CRM returns an error etc.) which would require lot of effort to be fixed.
    Questions -
    1) What is your opinion about the solution and suggestions about a better/cleaner way to implement it?
    2) Is there any standard approach to solve such kind of issue without creating so much of complexity (where we have to write code to keep the mapping and take care of all other issues)?
    3) Is there any pattern that can help solve this problem?
    4) Have you ever faced this issue and how did you solve it?
    Regards
    Ananya

    Hi Ananya,
    If its not required to give Order ID to Portal user immediately, you can update Portal with Order ID in async manner.
    What I propose is,
    1. Let Portal call in Async manner, thread is released. (JMS can be used as well to improve reliability.)
    2. CRM takes the request and responds with order id or an error, calls webservice of AIA.
    3. AIA's WS then update Portal with Order ID or error in proper format.
    Thanks,
    Manish

  • Running commands from the Command Prompt -  Runtime.getRuntime().exec()

    Hi there,
    I'm already able to run several commands in the command prompt.
    But my problem is that I need all the commands that I run share the same context.
    If, for example, I run "cmd /c set HOME=C:" (1st command), I want to be able to access that variable the next time, so that later when I run "dir %home%" it shows the directories in c: (This is just a example this is not what I really want to do...)
    I used code posted in a newsgroup (don't remember which)
    This is the code I use to execute commands:
         private int execute(String command)
         int exitVal = 0;
    try
    String nomeOS = System.getProperty("os.name" );
    String[] cmd = new String[3];
    if( nomeOS.equals( "Windows NT" ) || nomeOS.equals("Windows 2000") )
    cmd[0]="cmd.exe";
    cmd[1]="/c";
    cmd[2]=command;
    else if( nomeOS.equals( "Windows 95" ) )
    cmd[0]="command.com";
    cmd[1]="/c";
    cmd[2]=command;
    if (rt==null)
         rt = Runtime.getRuntime();
              Process proc = rt.exec(cmd);
              CommandStream erro = null;
              // erros?
              if (proc.getErrorStream()!=null)
                   erro = new CommandStream(proc.getErrorStream());
                   erro.start();
    // output?
    CommandStream output = new
    CommandStream(proc.getInputStream());
    // arranque
    output.start();
    // erros???
    exitVal = proc.waitFor();
         } catch (IOException e)
                   System.out.println("Exce !!!" );
                   e.printStackTrace();
         catch (InterruptedException ie)
                   System.out.println("Ocorreu uma excep��o !!!" );
                   ie.printStackTrace();
    return exitVal;      

    My problem is bigger than setting a few parameters,
    I'm doing a GUI to a CVS client and the problem is that some commands of CVS only work if you're in the right directory, or if you're authenticated, and all of this is easily done doing a series of execution:
    In a command prompt opened I would:
    set cvsroot=:pserver:lpinho@w2palf38:/project
    cvs -d :pserver:lpinho:xxxxx@w2palf38:/project login
    mkdir temp_my_proj
    cd temp_my_proj
    cvs checkout my_projectAll this would make what I wanted...
    And there's another thing, when I set the envp, I get some errors like "cvs.exe is not recognized as an internal or external command" (the path went bye bye) and if I set the path (envp[0]="path=c:\cvsnt"), I'm able to run cvs but I get a crazy error "No such host is known" (I run exactly the same command in the command prompt and it works...)
    Do you know any way of getting the current environment, and pass it as the envp parameter?
    Thank You
    Luis Pinho

  • How would you change the name of your mac? because i have a mac but its under my friends name because he set it up for me and i would like in under my name how would i change that?

    ?

    Hi D,
    That would do nothing as one needs to select an item at first in order to be able to select all, but I would like to know what is the information you would like to know about the OP's machine and, if possible, the reason.
    The correct procedure is the one that A posted before.
    Regards, K.

  • How do you capture the export button click event?

    <p>Hi, is this possible in VC++? Thanks.</p><p>Billy</p>

    Hi Billy.
    I would suggest asking this question in the VC++ forum as this forum is focused on the Design of the reports using Crystal Reports Designer.  Capturing events is a developer function and the way that Business Objects has split up these forums, it would make more sense and get the proper exposure there.
    Kindest regards,Â
         - Kathryn Webster (Report Design Consultant)
               Kat&#39;s News: http://diamond.businessobjects.com/blog/279

Maybe you are looking for