Hi,
i feel i should write my problem in detail.I have to give a print command from my java program which fires the print command of the printer anf on successfull execution it should print a message.I have written the code but it is not working.If anybody could help,it will be great.
import java.util.*;
import java.io.*;
public class PdfToTif {
/**
* @param args
*/
public static void main(
String[] args) {
System.load("C:\\WINNT\\System32\\SHELL32.DLL");
// TODO Auto-generated method stub
try
{
//System.out.println("print");
Runtime rt = Runtime.getRuntime();
//Process proc = rt.exec("print");
Process proc = rt.exec("cmd.exe ");
InputStream is=proc.getInputStream();
InputStreamReader isr=new InputStreamReader(is);
BufferedReader br=new BufferedReader(isr);
String str=null;
while((str=br.readLine())!=null)
System.out.println(str);
//System.out.println(proc);
int exitVal = proc.waitFor();
System.out.println("Process exitValue: " + exitVal);
System.out.println("1");
is=proc.getInputStream();
isr=new InputStreamReader(is);
br=new BufferedReader(isr);
str=null;
while((str=br.readLine())!=null)
System.out.println(str);
System.out.println("2");
} catch (Throwable t)
{
t.printStackTrace();
}
}
}
Thanks and regards,
Jyoti Giri