Runing an exec from class Runtime and redirecting its output ...?..?

Hello!
I am trying to run a C exec by using th eRuntime class.
This works well ...
But, I want to redirect its output to my transcript.
This also works with small output (some lines !) ...
But the out put is up to 3000 lines, my program does
not continue. It is suspended in a waiting state.
I suspected that the buffer is filled, but there is still some lines to be written ...?
Anyone knows this problem and the solution ..?
Thanks by advance
Yaz

You could try something like thisjava.util.List al = new ArrayList();
try {
     Process p = Runtime.getRuntime().exec("cmd.exe /c dir");
     BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
     String s = "";
     while ((s=br.readLine()) != null) {
          al.add(s);
     ListIterator li = al.listIterator();
     while (li.hasNext()) {
          System.out.println(li.next());
catch (IOException ioe) {}Mark

Similar Messages

  • Can I cancel mail job from SOST queue and make its status to be error or red

    Do you have any idea to cancel mail job from SOST queue and make its status to be error or red (msgno = 806) by using coding ??

    veekwall wrote:
    Hi,
    I recently (over this past summer) updated my phone and plan with Verizon.  I'm from Pittsburgh, Pennsylvania, and I got the phone in Pittsburgh.  It is a Droid Eris and very nice.  I got it and a month later I moved to Olympia, Washington for school.  Since moving there, I have hardly been able to use it.  The service is terrible and its been impossible to keep in touch with my family, I wasn't even able to call them over Thanksgiving.  I'm also having to pay extra money so I can use the internet on my phone, but I can't even access the internet let alone make phone calls.  It's really frustrating.  I can't use my phone to keep in touch with everyone in Pittsburgh-and if I am ever in trouble I wouldn't be able to call for help, which makes me really nervous.  Is there a way I can cancel my 2yr contract?  Yes.  Just visit a Verizon store, or dial *611 from your phone and let them know you would like to cancel your account.  Would I have to pay a fee-and how much would that cost? Yes, Verizon no longer waives ETFs due to moving to an area without service, so you will probably have to pay an Early Termination Fee.  Since you have a smartphone, it will probably be $350 less $10 for each month of service you have completed.  The Customer Service rep you contact about cancelling will be able to tell you the exact amount.  Would I have to go to the Verizon store I bought the phone from to do this or would I have to do this in Washington-where I am now living and having the problems? You can do it over the phone, or at a corporate Verizon store.  Help!
    -Victoria

  • Hi my name is Aditya. i am using ipad 2. 2 days ago my ipad fall down from my hand and now its screen is not working it is totally blank but shocking thing is that when i take a screen shot the display came back for 2-3 second. any one like me?

    hi my name is Aditya. i am using ipad 2. 2 days ago my ipad fall down from my hand and now its screen is not working it is totally blank but shocking thing is that when i take a screen shot the display came back for 2-3 second. dose ne 1 have same problem....?

    Anyone have any suggestions? or is everyone else just as clueless as me !

  • HT1369 I tried to update my phone to the new system but i removed it from my cpmputer and now its stuck on the connect USB to itunes screen.....

    I tried to update my phone to the new system but i removed it from my cpmputer and now its stuck on the connect USB to itunes screen.....HELP

    Hello the_generator2003,
    It sounds like after having disconnected the iPhone physically during the update process, the phone appears to be stuck in recovery mode. If you have followed the onscreen image, and reconnected the device to your computer, then I would start by resetting the phone and trying again:
    From: Turn your iOS device off and on (restart) and reset
              http://support.apple.com/kb/ht1430
    If the issue is not resolved, then try putting the unit into recovery mode again with this article:
    iOS: Unable to update or restore
    http://support.apple.com/kb/HT1808
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • How to execute some code in command line, and read its output?

    I'v found here http://www.sap-advisor.com/abap-coding/how-to-execute-operating-system-commands-from-within-sap/ that I can execute commands from the windows command line for example inside SAP.
    But I want to take it one step further and read its output. is it possible?

    Hi RagnaRock,
    one possible approach can be outputting the results of the command into a text file (i.e. "command >result.txt"), and then read this file from SAP/ABAP.
    I hope this helps. Kind regards,
    Alvaro

  • IS there an easy way to execute a shell command and capture its output...

    From an application? I am thinking of using fork and then waiting for the PID to finish and write the output to a file which I then read, but this seems clunky. Also there are big warnings about frameworks getting hosed if you use fork, although the "Forked" process will exec the shell command and the one that gets the PID the original process might be 'safe' from this framework corruption. I am not certain of this, it is just a guess.
    If there was something like a process class where I could specify the executable and parameters, and read from it's std out until the process completed, that would be better. Or even get a callback when the process exited and an asynchronous callback for each line of data it produced.

    That was just in response to OrangeKay implied accusation that I was some kind of hard-core Microsoft programmer that sneered at apple programmers.
    You may want to book mark this, I will go over a brief history which should clear a lot of things up, about me, and about what I am doing.
    Lets turn the clock back to 1998: I graduate from a university with a BS in Computer science. I had been interning at a local defense contractor writing missile testing software. This was on a proprietary hardware and so there was no "Microsoft" involved. At this point I think Bill Gates = Satan. Microsoft = Kingdom of Evil.
    I get a job as a video game programmer. I write code from the Playstation, then the Playstation 2 and Gamecube. I do this for several years and again I have zero interest / knowledge of the Microsoft world beyond it being the OS which I am forced to use to play my games on. I had fought this by trying to use OS Warp and other things, but eventually since I mainly had a PC for games I had to get a windows OS, the first being NT 3.51 and then Win98 cause NT4.0 didn't support past directx 3 and everyone was using directX 5 or 6 (I do not remember).
    As video game companies go, they do not last. Everyone wants to write video games, anyone with some cash wants to start a company. 1 in 1000 will make it 5 years. Needless to say, as our company began to tank, I got laid off, along with my entire team. I have cash in the bank, no big deal, right?
    Well the economy started to suck, video game developers were closing down like crazy so the market was saturated with x-video game developers. 2 Years go by, no job, and almost no money. Then I get a call from some guy who wants me to come for an interview about 75 miles away. It is in a place I do not want to go. So they interview me, and ask me a bunch of general programming questions.
    I leave the place, and by the time I get home there is a message on my machine asking me if I would take the job at a ridiculously high salary (I live in an area where the cost of living is very low). Well I am about out of money and its a job offer with a huge salary, so I take it.
    I get there and guess what? I get to work on this "agent" that runs on windows boxes. I have NO IDEA how to program on windows. Windows is evil, why would I want to taint myself with this vile Microsoft APIs? I really have no choice, I have to learn how to develop on windows. I get to use visual studio 6, which I do not understand because I used the Borland compilers (Borland != Microsoft).
    Well I start to slug through it all and get familiar with MSDN and CodeProject and CodeGuru. As the years pass, I begining applicate the examples and detailed documentation that MSDN has. I have a start page on MSDN which covers every category of operation which will take you through a tree of choices and lead you to the exact area related API calls you will need to use to do whatever you want. Now I do not think MS = Evil anymore. I switch to DevStudio 2005 which is really nice. The debugging, IDE, and everything is great.
    Now the other half of this application resides on a server. That server is a Linux box, and the server app is written in Java. My stuff is still C++.
    One day, I get a request, and a eMac with 10.4 PPC to make a Mac version. Now I am at the point of Mac programming as I was with Windows when I started. I didn't know anything about it. I was looking for CodeWarrior cause I used that in the past, but alas, CodeWarrior is no more. I get XCode. I see all sorts of options to make a project. BSD project, Carbon, Cocoa, etc... What the heck any of these. I can guess the BSD one is very basic, but I do not understand Carbon vs Cocoa.
    So what do I do? I make a basic carbon app and make a basic Cocoa app. The carbon app looks like some kind of C++ framework. The Cocoa app? "Is this another language like Java or C#? It doesn't look like a C++ language."
    Guess which choice I make. Carbon. I struggle through this looking at the docs, posting on CodeGuru and whatnot until someone finally tells me about these forums and warns me about how unfriendly people are. So I make an account and start asking questions. I eventually get my app to be multi-platform to run on windows and Mac by using some API abstractions which are easy to do since I had abstracted the Windows API by my own class wrappers.
    I ask a lot of questions, very few are ever answered because I am not asking about simple things, like making windows and how to get button clicks and that stuff. I am asking stuff like, "How do you change the DNS? or How do I know when a user is about to log out?" Currently on my side list as I type this, I have 27 unresolved questions. I probably found workaround for most of them, or figured it out eventually.
    On this forum mostly people are helpful when the do respond, except for OrangeKay. He definitely has a chip on his shoulder.
    Over the past few years my Opinion of MS has improved greatly while my opinion of Macs (from the programmer's point of view) has dropped considerably. XCode still isn't as good as VS6 which is like 15 years old, never mind Dev studio 2005 or 2008. The documentation is scattered, not easy to find, occasionally wrong, or simply missing. The examples may not even compile or contain non-existent functions. It is unbelievable how bad it is.
    If Steve Jobbs wants to really get a large coder population he ought to spend some of those billions (or is it trillions) of dollars on a team that will re-write the current documentation in a correct, easy to understand, with full examples, arranged in a logical manner for everyone to use. He should say, "See MSDN online? I want something like that, only better, it has to be MUCH better." Then he should say to the XCode team, "Look at DevStudio 2008. XCode should do EVERYTHING that does. Once that is done, IMPROVE XCode even more to make 2008 look like a joke."
    To bad the Developer aspect of the "Apple Experience" has not gotten "End User" treatment. Then it would be a joy to develop on Macs.
    So here I am asking for help on certain things. You wonder why I do not use Cocoa. Maybe I should, maybe I shouldn't. My first look didn't look promising, and a quick look at the docs is all about GUI's. My app has NO GUI. Again, Cocoa? Maybe it will still work, but the examples and stuff I see are all about GUIs.
    When I get time, I will look at cocoa even further. MFC on windows is MOSTLY about GUI stuff, but there is a small section of it that does not deal with GUIs. CString is a great MFC class. I had to get rid of it though cause Mac's do not have a similar class. I use CStdString which is a platform agnostic CString replacement.
    I hope you are all a little more enlightened. BTW my Application which runs on Mac's and PCs on no less then 3 MILLION Machines has not crashed ONCE in the past 2 years. There have been bugs, but nothing that crashed it. The bugs were mostly unforeseen situations, like what if the guy has 15 network adapters that are all LIVE? I didn't plan for that, there were complications, the server got some strange data, but it didn't crash (My app, not the server. It crashes on occasion still). Are there bugs in my code? I am sure there are, but I do not know of any, because if I did, it would be fixed.

  • Call tcode KSB1 in a custom program and modify its output

    I was searching the forum for finding a way to create a program that has all details from KSB1 and some details from CJ13 (WBS details) and found some related posts. But none of the posts had any details on how to actually achieve this.
    I have to do a similar thing of getting the KSB1 output and add WBS details for each line item and then give the final output.
    If you have already done this before, please elaborate on the steps how you achieved it.
    Please specify the SUBMIT that you had written to call KSB1. If I can have all details from KSB1 in my memory, then I can read that in my program and add WBS details and give the output.
    Below is what I am doing but it gives the same error as one of you had - transaction code not defined.
    DATA: FCODE TYPE SY-TCODE VALUE 'KSB1'.
    SUBMIT RKAEP000 WITH SY-TCODE = FCODE.
    Any help would be appreciated. Thanks.
    Regards,
    Shipra

    Hi,
    try this code it will work..
    the data is stored in txtlines format the data by the field wise.
    * Data Declaration
      DATA:lt_listobject TYPE TABLE OF abaplist,
        l_tab_lines TYPE i.
      DATA: txtlines(1024) TYPE c OCCURS 0 WITH HEADER LINE.
      SUBMIT rkaep000                      "the program name
         USING SELECTION-SET 'BPC TEST'          "Pass varint BPC Test
               EXPORTING LIST TO MEMORY AND RETURN.
    * Read list from memory into table
      CALL FUNCTION 'LIST_FROM_MEMORY'
        TABLES
          listobject = lt_listobject
        EXCEPTIONS
          not_found  = 1
          OTHERS     = 2.
      IF sy-subrc  0.
    *   Error in function module &1
      ENDIF.
    *Spool content in Ascii format
      CALL FUNCTION 'LIST_TO_ASCI'
        TABLES
          listobject         = lt_listobject
          listasci           = txtlines
        EXCEPTIONS
          empty_list         = 1
          list_index_invalid = 2
          OTHERS             = 3.
      CALL FUNCTION 'WRITE_LIST'       "Display report same as in KSB1... else not required
      TABLES
        listobject = lt_listobject
      EXCEPTIONS
        empty_list = 1
        OTHERS     = 2.
    CALL FUNCTION 'LIST_FREE_MEMORY'
      TABLES
        listobject = lt_listobject.
      LOOP AT txtlines.   "data will be stored in this..
        " split the txtlines-tdline with | and move into another internal table and do the validation...
      endloop.
    Prabhudas
    Edited by: Prabhu Das on May 20, 2009 11:28 PM

  • Calling a stored procedures and using its output parameters in a report

    Hi,,
    I have a procedure defined in a package on the database. This procedure returns a number of output parameters. How do I call this procedure and use the output parameters in my report ?
    Thanks, Mark

    Depends on the level at which the procedure has to be called. If its at report-level, call the Form in the BEFORE-REPORT-trigger (or AFTER-PARAMFORM) and store the out-values in Placeholder-columns. These you can use anywhere in your report.

  • CLIPBOARD_EXPORT from class CL_GUI_FRONTEND_SERVICES and string table - sh

    Hi Gurus,
    I have a problem with this method. When I'm passin to it table of strings I'm getting short dump. Something about RFC and XML. In my opinion this is error in SAP coding, but maybe I'm wrong. Has anyone this kind of problems with this method? Maybe there is a note to it?
    BR
    Marcin Cholewczuk
    Edited by: Rob Burbank on Jul 30, 2010 2:50 PM

    > @Sandra thank you, I know this will work
    Then, next time, you will ask the question clearly, because it's not what we all have understood!
    > but I still think that this short dump is an effect of error in SAP coding so my question remains.
    No, as I said, all functions based on frontend / OLE always used the C type. When OLE was issued in release 3, the STRING type didn't exist (available since 4.6). As OLE worked very well with C type, they had no reason to spend time to make it work for other types (there is always a risk that there are new bugs, I don't see why it should be considered as a bad policy).
    You may simply argue that the documentation is not complete (or even inexistent sometimes), that's all.
    In your case, we see that the CLIPBOARD_EXPORT method documentation is incomplete:
    DATA (exporting) Contains a table of the data to be copied to the clipboard.
    SAP always worked like that, and we abapers, always had to guess and spend time how these API work. But that's not a big deal usually (as for this one).

  • Converting a string to Class object and calling its method

    I have recently moved to Java and I need help on this specific issue given below.
    I have to do this :
    ValModule1 val1 = new ValModule1();
    ValModule2 val2 = new ValModule2();
    if(val1.checkModule(xmlDocument)){
    $i++;
    There are many ValModule* classes and they all have the method called checkModule in them. I need to instantiate each class and run the checkMethod which returns true or false. My problem is that I am trying to get the name of the module (if it is ValModule1 or 2 or 3) from the user. What I get from the user is the name of the class for which I should call checkModule method on.
    how can I convert this string validationname given by the user and instantiate that class and call the method?
    I have tried this:
    String str="c:/xpathtest/src/Plugin_Config.xml";
    File xmlDocument = new File(str);
    String cls = "ValModule1"; // assuming this is what the user gave me
    Class t = Class.forName("ValModule1");
    Object o = t.newInstance();
    After that if I try
    if(o.checkModule(xmlDocument)){
    $i++;
    It gives me an error saying that it is not an existing method
    cannot resolve symbol
    [javac] symbol : method checkModule (java.io.File)
    [javac] location: class java.lang.Object
    [javac] if(o.checkModule(xmlDocument)){
    [javac] ^
    [javac] 1 error
    Can you please let me know where I am screwing up :-) ? If you need me to put both the programs I can do that too. Thanks in Anticipation

    I have recently moved to Java and I need help on this
    specific issue given below.
    I have to do this :
    ValModule1 val1 = new ValModule1();
    ValModule2 val2 = new ValModule2();
    if(val1.checkModule(xmlDocument)){
    $i++;
    There are many ValModule* classes and they all have
    the method called checkModule in them. I need to
    instantiate each class and run the checkMethod which
    returns true or false. My problem is that I am trying
    to get the name of the module (if it is ValModule1 or
    2 or 3) from the user. What I get from the user is
    the name of the class for which I should call
    checkModule method on.
    how can I convert this string validationname given by
    the user and instantiate that class and call the
    method?
    Define an interface containing the method all your classes have in common, cast the Object reference returned by newInstance to that interface, then you can call that method.
    Good Luck
    Lee

  • I recently downloaded the latest OS update and now I have a constant "humming" noise from my MBP and my audio output is no longer working. Any suggestions?

    I recently downloaded the lastest OS update (Lion X 10.7.4) on my MBP that I purchased in November of 2011, and since downloading it my MBP has been making a constant "humming" noise from the right speaker/disc drive area. I also don't have any audio output for FaceTime or Skype. I attempted to use Photo Booth to record a video and it doesn't record any audio. I attempted to reset SMC and reinstall Lion with no resolution of the problems.

    Click the Finder icon on the Dock.
    Applications > Utilities > Audio MIDI Setup
    Built-in-Output
    Output tab
    Move the Master volume slider to the right a bit.
    Best.

  • How do i remove an app from my imac, and all its associated files

    I know you can drag an item to the trash can but i have heard there are files left on the computer that don't get deleted.  So how do i get rid of them?

    If the app has an uninstall routine use that. If it doesn't you can use a utility such as AppCleaner. BTW if you have come from the MS Windows world uninstalling apps Macs is really simply just drag them to the trash. Any files left behind will not affect the performance of the system and are normally so small (KB's) that they can be ignored. Tools like AppCleaner are not totally necessary to be honest, they're there to just make us feel better.

  • Determine which vi is executing at runtime and read its block diagram

    I have a time-critical loop.  Within this loop, one of a set of
    known VI's is chosen in a case statement.  Within each of those
    VI's, data is decoded in a specific way.  I cannot modify these
    VI's to make the information I need available, because it would
    increase the amount of execution time of the tight loop.
    What I need to do is write a new VI which will "read" the components of
    the block diagram, so I can determine dynamically what code is being
    run.  For example, if there are three blocks in the running VI
    that extract an array element, I need to be able to determine the index
    of the array elements being extracted.
    I could re-encode all of this information in a new VI, but that would
    generate a maintenance headache, because the decoding algorithms would
    have to be kept identical for every incremental change.
    Is it possible to "read" the contents of a VI from another VI without reverse-engineering the VI file binary format?

    Actually, no.  I'm probably not being very clear.  I'm not
    interested in looking at the values within the VI, I want to be able to
    see what the VI is doing.  I don't want to see the result of
    ExtractDataFromArray() (which I know is not a real function -- it was
    just an example), that is, I DON'T want to see the values on a "wire"
    during execution.
    Rather, I want to know how many instances of a certain kind of sub-VI
    are in a VI, I want to know how many instances of constants there are,
    and which sub-VI's they are wired to.
    I want to be able to find this information, essentially:
        In FOO.VI:
           bar.vi is called seven times, each time, the INPUT1 is wired to terminal 1,
            and for the 7 various instances, the values "1," "3," "12," "17," "23," "35," and "71" are wired to terminal 2.
    In C-speak, I don't want to know the result of the calls to the imaginary function ExtractDataFromArray(),
    rather, I want to know that it was called seven times, with the
    arguments (&input1, 1), (&input1, 3), (&input1, 12), ...
    And I don't care what was in &input1 when it was called, just THAT it was called.
    Essentially, I want to be able to have one VI analyze another and determine what it does.

  • I erased everything from my phone and now its stuck on the apple screen. How do i fix this?

    i thought i was resetting my phone but i erased everything and now my phone is stuckon the apple screen. how do i get my phone to work again?

    What exactly did you do?
    How long has it been?
    Erase all content and settings can take several hours.

  • Calling the standard program in program and getting its output in int table

    Hi there,
    I have a requirement, where I need to call the standard program (of transaction CJI3) in my Y program. CJI3 transaction produces a ALV GRID output. I need to use that data for further processing. I am getting following problems:
    1. I tried to use SUBMIT ... EXPORTING TO MEMORY statement. I need to pass the company code for the selection, but the company code is in the dynamic selection. So not getting how to pass them.
    2. Just a doubt. Can we export the ALV GRID to the memory an retrieve it back using import?
    3. I did tried to use SUBMIT .....  statement using only the parameters which are on the selection screen. However the control went to CJI3 transaction and gave an error message 'Please select "from database" or "from archive" '. Did not understood that, any IDEA?
    Or is there any other way with which I can accomplish my requirement of getting the data in my program to manipulate, other than SUBMIT.
    Points will be rewarded.
    Thanks,
    Ganesh Khumse

    Hi,
    point 1:
    SUBMIT ... EXPORTING TO MEMORY will never work, because it displays the information in an ALV grid and that grid is waiting for user interaction for manipulating the information.
    point 2:
    no, you cannot export the content of an ALV grid to the memory
    point 3:
    must you get records in an internal table or must you feed the transaction, so that this one performs a task ??  for first option read below and for the other option you might work with BDC and Transaction Recorder.
    what you have to do is read the code of transaction CJI3 in order to understand what it does, where the information is read from and what is the internal table that passes the values to the ALV Grid. You might find a user exit in the code for manipulating that information or you might create an enhancement point if there´s no user exit.

Maybe you are looking for