4 Replies Latest reply on Sep 29, 2007 12:52 PM by harshi2003

    Not identify network printer when JBoss start as windows ser

    harshi2003

      Hi,

      In my application i try to print pdf documents using
      Runtime.getRuntime().exec("CALL START /MIN AcroRd32.exe /h /p ")

      Further I identify the default printer by
      PrintServiceLookup.lookupDefaultPrintService();

      when i start jboss through run.bat the application works ok. it identifies the default printer of the machine.

      however when start jboss as a windows service the appliaction does not identify the default printer.

      A shared network printer is installed in to this machine. It seems that shared network printer is not identified by the application when I start jboss as NT service.

      I have used Java Service Wrapper provided by Thanuki software.org to register Jboss as windows service.

      http://wrapper.tanukisoftware.org/doc/english/integrate-simple-win.html

      Please help me to resolve this issue.

      Thanks in advance

        • 1. Re: Not identify network printer when JBoss start as windows
          peterj

          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.

          • 2. Re: Not identify network printer when JBoss start as windows
            harshi2003

            Thanks Peter.
            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);
            out.close();
            fw.close();
            String batPath = PDFPath + "printPDF.bat";
            tr = Runtime.getRuntime();
            Process p = tr.exec(batPath);

            any ideas.

            Thanks in adavance

            • 3. Re: Not identify network printer when JBoss start as windows
              peterj

              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".

              • 4. Re: Not identify network printer when JBoss start as windows
                harshi2003

                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.

                Thanks again