Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
Problem with all Netware console commands. How will you use the console output from a code either in C or java? There is no way to collect the command output in a code as the output always goes to console. Any ideas?
Run a commnand like "volumes" on netware console and see output on the console. Same output seen on console if the command is executed through a java code (as given at bottom). But the output does not go to the 'Process' object as given in the code. Only IOException got when trying to read the output. The code at the end does not work. Please help me on how to capture and read the netweare console output through the code.
Thanks
murali
import java.io.*;
public class RunCommand {public static void main(String args[]) {
String s = null;
try {
// run the "version" command
Process p = Runtime.getRuntime().exec("version");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
}

All you need to do is redirect if to a file and read the file.
Netware6:volumes > file(look in file)
You can do the same thing in DOS since ver 3 and still in CMD.exe on NT....
HTH

See, I have netware 5.1 and volumes > out.txt does not redirect to file. I even gave full path name like sys:out.txt (tried with without spaces) Does not work..

![]() |
Problem with file Q_0005 ...
|
Migration to new hardware...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |