res.setContentType("text/plain");
PrintWriter out = res.getWriter();
String command = "finger";
Runtime runtime = Runtime.getRuntime();
Process process = null;
try {
process = runtime.exec(command);
DataInputStream in = new DataInputStream(process.getInputStream());
// Read and print the output
String line = null;
while ((line = in.readLine()) != null) {
out.println(line);
}
}
catch (Exception e) {
out.println("Problem with finger: " +
ServletUtils.getStackTraceAsString(e));
}