Problem while Printing through Networkwork Printer using JCIFS

Thiyagu Venkatesan v.thiyagu.mca at gmail.com
Wed Apr 30 14:32:54 GMT 2008


Hi All,


I have a problem while printing through Network Printer using JCIFS

OS :Windows
Printer : HPLaser

The problem is

1. I can able to find the available network printer.
2. I gotted the SmbFile object for the specific Network Printer.
3. When I try to do the following piece of code

java.io.OutputStream fos=file.getOutputStream();  //where file is object of
SmbFile.....i.e shared network printer
  java.io.PrintStream ps=new java.io.PrintStream(fos);
  ps.print("God is Great");
  ps.print("\n");
  ps.print("ALL THE BEST");
  ps.close();
  System.out.println("File Writed");

 Im getting the following error

The parameter is incorrect.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:526)
at jcifs.smb.SmbTransport.send(SmbTransport.java:626)
at jcifs.smb.SmbSession.send(SmbSession.java:239)
at jcifs.smb.SmbTree.send(SmbTree.java:109)
at jcifs.smb.SmbFile.send(SmbFile.java:718)
at jcifs.smb.SmbFile.open0(SmbFile.java:923)
at jcifs.smb.SmbFile.open(SmbFile.java:940)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:67)
at jcifs.smb.SmbFile.getOutputStream(SmbFile.java:2779)
at javaprint.LocateNetPrinter.findAllPrinters(LocateNetPrinter.java:66)
at javaprint.LocateNetPrinter.main(LocateNetPrinter.java:121)
Exception in thread "main"


Can anybody help me to get the OutputStream of Printer, so that I can able
to print the msg in Printer.

Reply me..........

Thanks in Advance
Thiyagu.


More information about the samba-technical mailing list