Under which account is the service running? If it is running under the System account, you should try setting the service to run as another account ( I usually set up a specific account for the service). And then make sure that if you log in as that account that you have access to that printer, and that the account has the default printer set. If you do, then the printing should work.
Actually the Service running under the system account. I have set up an account for the service. this account has administrative priviledges. now the application identifies the printer. since i have created a bat file and execute now it doesn't print because the user account doesnot have priviledges to the killing of the process.
please find the code attached
FileWriter fw =new FileWriter(PDFPath+"printPDF.bat");
PrintWriter out = new PrintWriter(fw);
out.println("taskkill/IM AcroRd32.exe /t");
out.println("CALL START /MIN AcroRd32.exe /h /p "+PDFPath+filename);
String batPath = PDFPath + "printPDF.bat";
tr = Runtime.getRuntime();
Process p = tr.exec(batPath);
Thanks in adavance
Login with the account the service is running in, and enter the commands by hand. If that will not work, it will not work from the service. If it does work, it should work from the service, because things like this should depend only on the account permissions.
Also, check your syntax, I think you need a space between "taskkill" and "/IM".
Thanks. Yes it works when i create and register the service with a user account which has doman access. further i use Run as command to specify the user and kill the task.