• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a printer from Unix Environment

 
Aditya Prasad
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

My application is deployed in AIX.The java code for printing is not working.
I am reading a file which contains the printer configuration and based on the availability either the local printer or a remote printer will be accessed.The code works fine in windows. But in UNIX environment i don't know wat's wrong with the code. Can anyone help me out in this regard ?

what can be the printer path when we try to access from a unix environment.
If you try from windows it will be \\172.20.162.216\Printer Name

Can anyone of you help me ??

Thanx in Advance..


Here is my code

------------------------
The printer configuration files is
//Select 1 to print without ip address. And use 2 to print using ip address
1:lpt1
2:172.20.170.94 omestic Projects-3FS
------------------------------
My java code :-


public PrintManager(String st[])
{
this();
System.out.println("PrintManager: Inside 3rd const: after calling this():as: ");
name = st;

String stline ="";
StringTokenizer stok = null;
try {
File file = new File("/ibs/PrintConfig.cfg");//Unix environment
BufferedReader br = new BufferedReader(new FileReader(file));

while((stline=br.readLine())!=null)
{
if(!stline.startsWith("//"))
{
stok=new StringTokenizer(stline,":");
stFlag = stok.nextToken();
if(stFlag.equals("1"))
{
stPrintString = stok.nextToken();
}
else if(stFlag.equals("2"))
{
stPrinterIP = (stok.nextToken());
stPrinterName = (stok.nextToken());
stPrinterPath = "\\\\"+stPrinterIP +"\\"+stPrinterName ;
System.out.println(" Printer Path is :" + stPrinterPath );

}


}
}
}catch (Exception e)
{
System.out.println ("Exception while printing :"+e);
}

}
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java printing API really doesn't fall under the topic of the "Distributed Java" forum, so I'll move it to "Other Java APIs"...
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer depends on all sorts of factors, including perhaps what OS the machine the printer is attached to is running, perhaps how the printer is configured, perhaps what print queue software the machine is using, etc. In general, a UNIX machine needs to be running a Samba client (or a commercial equivalent) to be able to print to a Windows printer, and a print queue for that printer may need to be configured.

I'm personally far from being an expert on this topic, and it sounds like the same is true for you. Your best bet is to find someone locally who knows how to configure these things so that the printer is accessible from the AIX machine. Once that's set up, that person should be able to tell you the necessary connection information.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic