hi to all ,i am facing problem with printservice class to print a simple text document using java code .This is my code
Java Code:
public class SimpleTextPrintDemo {
     FileInputStream in ;
    /** Creates a new instance of SimpleTextPrintDemo */
    public SimpleTextPrintDemo() {
        try {
            in=new FileInputStream("some text file location in my disk");
            DocFlavor doc= DocFlavor.INPUT_STREAM.TEXT_PLAIN_US_ASCII;
            Doc mydoc =new SimpleDoc(in,doc,null);
            PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
            set.add(new Copies(2));
            PrintService[] services=PrintServiceLookup.lookupPrintServices(doc,set);
            System.out.println("no of printservices " +  services.length);
            if(services.length>0){
                System.out.println(services.length);
                services[0].createPrintJob();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public static void main(String[] args) {
        new SimpleTextPrintDemo();
    }
    
}
please note that no exceptions.but i am getting zero no of print services .I checked my printer connections it is working fine.so no problem with my printer only with my code .please help me .