W
WinstonSmith_101
I have an external program I need to execute which takes an argument.
So I have the code:
String command = "...";
String argument = "...";
process = Runtime.getRuntime().exec(command);
And then for sending arguments:
java.iutputStream out = process.getOutputStream();
out.write(argument.getBytes());
out.close();
And the for reading output from the external command:
java.io.InputStream in = encryptProcess.getInputStream();
int c;
while ((c = in.read()) != -1)
{
System.out.print("OUT: " + (char)c);
}
in.close();
= = = = = = = = = = = = = = = = = =
But the problem is that the output is not actually read. It's still
being outputted when I close the InputStream (in.close()
Is there not a way to but execute an external program, send arguments
to it and get it's output?
I have tried to insert the command "echo argument|command" e.g.
"echo test|ls" in the command, but this merely echos out the whole
line ("test|ls") rather than sending the argument "test" to
"ls".
Thanks
/Rune
So I have the code:
String command = "...";
String argument = "...";
process = Runtime.getRuntime().exec(command);
And then for sending arguments:
java.iutputStream out = process.getOutputStream();
out.write(argument.getBytes());
out.close();
And the for reading output from the external command:
java.io.InputStream in = encryptProcess.getInputStream();
int c;
while ((c = in.read()) != -1)
{
System.out.print("OUT: " + (char)c);
}
in.close();
= = = = = = = = = = = = = = = = = =
But the problem is that the output is not actually read. It's still
being outputted when I close the InputStream (in.close()
Is there not a way to but execute an external program, send arguments
to it and get it's output?
I have tried to insert the command "echo argument|command" e.g.
"echo test|ls" in the command, but this merely echos out the whole
line ("test|ls") rather than sending the argument "test" to
"ls".
Thanks
/Rune