title: Always picking the default printer instead of the one specified, JAVA
body: <p>i have a printing program in java, but for some reason it always picks the default printer (8600), even when i pass a value of say xps for printer, what have i done wrong, and how can i get it to select the required printer</p>
  
  <p>heres my code :</p>
  
  <pre><code> PrintService[] printServices = PrintServiceLookup.lookupPrintServices(null, null);
          System.out.println("Number of print services: " + printServices.length); //tells me how many print services are isntalled on the server.
  
          for (PrintService printer2 : printServices) {
              System.out.println("Printer: " + printer2.getName()); //prints out the names of all printers on the server, testing purposes 
          } 
  
  
          PrintUtility.findPrintService(printer); // selects only the 8600 printer // EDIT now selects any printer with the name provided
  
  
          PrintService[] services =
                  PrintServiceLookup.lookupPrintServices(psInFormat, null);
          //System.out.println("Printers avialiable are " + services);
          System.out.println("Printer Selected " + services[Printerinx]);
  
          //PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
  
          DocFlavor[] docFalvor = services[Printerinx].getSupportedDocFlavors();
          for (int i = 0; i &lt; docFalvor.length; i++) {
              System.out.println(docFalvor[i].getMimeType());
          }
          if (services.length &gt; 0) {
              DocPrintJob job = services[Printerinx].createPrintJob();
              try {
                  job.print(myDoc, aset);
                  System.out.print("Printing Doc");
              } catch (PrintException pe) {
                  System.out.print(pe);
              }
          }
  </code></pre>
  
  <p>This is the console :</p>
  
  <pre><code>INFO: Number of print services: 7
  INFO: Printer: Send To OneNote 2013
  INFO: Printer: Microsoft XPS Document Writer
  INFO: Printer: HP988FD1 (HP Officejet Pro 8600)
  INFO: Printer: HP Officejet Pro 8600 (Network)
  INFO: Printer: Fax - HP Officejet Pro 8600 (Network)
  INFO: Printer: Fax
  INFO: Printer: Adobe PDF
  INFO: Printer Selected Win32 Printer : HP Officejet Pro 8600 (Network)
  INFO: image/gif
  </code></pre>
  
  <p>Thanks</p>