Here you can find the source of getAvailablePrinters()
public static PrintService[] getAvailablePrinters()
//package com.java2s; //License from project: Open Source License import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.PrintServiceLookup; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Copies; public class Main { public static PrintService[] getAvailablePrinters() { final PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet(); printRequestAttributeSet.add(new Copies(1)); return PrintServiceLookup.lookupPrintServices(DocFlavor.INPUT_STREAM.PNG, printRequestAttributeSet); }//from w ww . j a v a 2s.c o m }