aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Accessing a printer from Unix Environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Accessing a printer from Unix Environment" Watch "Accessing a printer from Unix Environment" New topic
Author

Accessing a printer from Unix Environment

Aditya Prasad
Greenhorn

Joined: Sep 02, 2004
Posts: 13
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

Joined: Oct 18, 2000
Posts: 4121

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"...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing a printer from Unix Environment