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;
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
add a comment |
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
add a comment |
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
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
java linux command processbuilder
asked Mar 25 at 9:42
user1716304user1716304
155 bronze badges
155 bronze badges
add a comment |
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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