Here you can find the source of getArrayOfPrinterNames()
public static String[] getArrayOfPrinterNames()
//package com.java2s; //License from project: Open Source License import javax.print.PrintService; import javax.print.PrintServiceLookup; public class Main { public static String[] getArrayOfPrinterNames() { PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); String printers[] = new String[services.length]; for (int i = 0; i < services.length; i++) { printers[i] = services[i].getName(); // System.out.println("PRINTER: " + printers[i]); }//from w w w.j a va 2s . c o m return printers; } }