ProcessBuilder not returning with linux command responseCalling an external command in PythonHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to symlink a file in Linux?How do I change permissions for a folder and all of its subfolders and files in one step in Linux?What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?How to exclude a directory in find . commandHow to change the output color of echo in LinuxHow do I copy folder with files to another folder in Unix/Linux?How do I find all files containing specific text on Linux?Why does the C preprocessor interpret the word “linux” as the constant “1”?

Why doesn't a marching band have strings?

Find the diameter of a word graph

How do I professionally let my manager know I'll quit over cigarette smoke in the office?

Should I prioritize my 401(k) over my student loans?

Is this one of the engines from the 9/11 aircraft?

Find the C-factor of a vote

Why is the voltage measurement of this circuit different when the switch is on?

3D Crossword, Cryptic, Statue View & Maze

In the Marvel universe, can a human have a baby with any non-human?

Is a single radon-daughter atom in air a solid?

Inverse-quotes-quine

STM Microcontroller burns every time

Can White Castle?

How is hair tissue mineral analysis performed?

Archery in modern conflicts

Trainee keeps missing deadlines for independent learning

What is the legal status of travelling with methadone in your carry-on?

If you snatch, I trade

How convert text to hex value?

Apply brace expansion in "reverse order"

Wifi dongle speed is slower than advertised

Swapping rooks in a 4x4 board

Tantum religio potuit suadere malorum – Lucretius

Can any NP-Complete Problem be solved using at most polynomial space (but while using exponential time?)



ProcessBuilder not returning with linux command response


Calling an external command in PythonHow do I prompt for Yes/No/Cancel input in a Linux shell script?How to symlink a file in Linux?How do I change permissions for a folder and all of its subfolders and files in one step in Linux?What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?How to exclude a directory in find . commandHow to change the output color of echo in LinuxHow do I copy folder with files to another folder in Unix/Linux?How do I find all files containing specific text on Linux?Why does the C preprocessor interpret the word “linux” as the constant “1”?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am having an issue running a linux command using ProcessBuilder in java



I have already tried the following



  • redirecting the output and error streams just in case to see if I still get a response or not

  • creating a bash script file out of the plain command to see if that works

  • using sh/csh to run the command

nothing from the above seems to work. Any help in this regards would be highly appreciable!



ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c",
"exec /proj/tgf_ki/dailytest/bin/tgv STABTDD4A");
System.out.println("command :: " + builder.command());
Process child = builder.start();
List<String> lines1 = new ArrayList<>();
InputStreamReader isr = new InputStreamReader(child.getInputStream());
BufferedReader br = new BufferedReader(isr);
br.lines().forEach(lines1::add);
System.out.println(lines1);

child.waitFor();



I expect that I get a response back from the outputstream but the thread just waits indefinitely at the line child.waitFor()



there is another similar command called tgr which returns successfully with the response! Since I am an external developer towards the scripts provided by the client, I am not really sure if there was any difference in the scripts tgr and tgv










share|improve this question




























    0















    I am having an issue running a linux command using ProcessBuilder in java



    I have already tried the following



    • redirecting the output and error streams just in case to see if I still get a response or not

    • creating a bash script file out of the plain command to see if that works

    • using sh/csh to run the command

    nothing from the above seems to work. Any help in this regards would be highly appreciable!



    ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c",
    "exec /proj/tgf_ki/dailytest/bin/tgv STABTDD4A");
    System.out.println("command :: " + builder.command());
    Process child = builder.start();
    List<String> lines1 = new ArrayList<>();
    InputStreamReader isr = new InputStreamReader(child.getInputStream());
    BufferedReader br = new BufferedReader(isr);
    br.lines().forEach(lines1::add);
    System.out.println(lines1);

    child.waitFor();



    I expect that I get a response back from the outputstream but the thread just waits indefinitely at the line child.waitFor()



    there is another similar command called tgr which returns successfully with the response! Since I am an external developer towards the scripts provided by the client, I am not really sure if there was any difference in the scripts tgr and tgv










    share|improve this question
























      0












      0








      0








      I am having an issue running a linux command using ProcessBuilder in java



      I have already tried the following



      • redirecting the output and error streams just in case to see if I still get a response or not

      • creating a bash script file out of the plain command to see if that works

      • using sh/csh to run the command

      nothing from the above seems to work. Any help in this regards would be highly appreciable!



      ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c",
      "exec /proj/tgf_ki/dailytest/bin/tgv STABTDD4A");
      System.out.println("command :: " + builder.command());
      Process child = builder.start();
      List<String> lines1 = new ArrayList<>();
      InputStreamReader isr = new InputStreamReader(child.getInputStream());
      BufferedReader br = new BufferedReader(isr);
      br.lines().forEach(lines1::add);
      System.out.println(lines1);

      child.waitFor();



      I expect that I get a response back from the outputstream but the thread just waits indefinitely at the line child.waitFor()



      there is another similar command called tgr which returns successfully with the response! Since I am an external developer towards the scripts provided by the client, I am not really sure if there was any difference in the scripts tgr and tgv










      share|improve this question














      I am having an issue running a linux command using ProcessBuilder in java



      I have already tried the following



      • redirecting the output and error streams just in case to see if I still get a response or not

      • creating a bash script file out of the plain command to see if that works

      • using sh/csh to run the command

      nothing from the above seems to work. Any help in this regards would be highly appreciable!



      ProcessBuilder builder = new ProcessBuilder("/bin/bash", "-c",
      "exec /proj/tgf_ki/dailytest/bin/tgv STABTDD4A");
      System.out.println("command :: " + builder.command());
      Process child = builder.start();
      List<String> lines1 = new ArrayList<>();
      InputStreamReader isr = new InputStreamReader(child.getInputStream());
      BufferedReader br = new BufferedReader(isr);
      br.lines().forEach(lines1::add);
      System.out.println(lines1);

      child.waitFor();



      I expect that I get a response back from the outputstream but the thread just waits indefinitely at the line child.waitFor()



      there is another similar command called tgr which returns successfully with the response! Since I am an external developer towards the scripts provided by the client, I am not really sure if there was any difference in the scripts tgr and tgv







      java linux command processbuilder






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 9:42









      user1716304user1716304

      155 bronze badges




      155 bronze badges






















          0






          active

          oldest

          votes














          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334948%2fprocessbuilder-not-returning-with-linux-command-response%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55334948%2fprocessbuilder-not-returning-with-linux-command-response%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript