[jcifs] Printing on a shared network printer

Luciano Barros Queiroz lqueiroz at stcruz.com.br
Thu Aug 25 12:41:54 GMT 2005


Hi all!

I'm new on JCIFS and would like to know if there is a way to send a text file from a Linux server to 
a shared network printer connected on a Windows workstation.

I have configured a generic printer and set it to shared on my Windows workstation.

I run the following code but it does not complete successfully. I returns the exception bellow when 
I try to create the SmbFileOutputStream object.
jcifs.smb.SmbException: The parameter is incorrect.



try
{
  SmbFileOutputStream out = new SmbFileOutputStream("smb://GUEST@10.41.1.1/GenericT/");
  SmbFileInputStream in = new SmbFileInputStream("/zebra/zebra2.txt");
  int c;

  while ((c = in.read()) != -1)
  {
    out.write(c);
  }

  out.close();
}
catch (Exception e)
{
  e.printStackTrace();
}







More information about the jcifs mailing list