PrintServiceLookup in Tomcat 4.0.3 / Centos 5.3

C

cyber sana

Dear Experts,

One week ago i ask about this and still cannot find the solution.

Problem:
In tomcat application, PrintServiceLookup cannot return any existing
printer:

PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(null, null);

But when I use this statement in a single .java to run & test
independently, it can find all my printer service.

I print out java version in tomcat
Java home: /root/j2sdk1.4.2_19/jre
Java vesion: 1.4.2_19

They are the same as the one I singlely compile .java source.

Can anyone give me hint why i cannot detect any printer in Centos
tomcat 4.0.3 ?

By the way, I build the class file first in windows (using same java
version, and can detect printers in windows tomcat) and move the class
to centos tomcat. Is it related ?


Thanks.
 
J

John B. Matthews

cyber sana said:
Problem:
In tomcat application, PrintServiceLookup cannot return any existing
printer:

PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(null, null);

But when I use this statement in a single .java to run & test
independently, it can find all my printer service.

I print out java version in tomcat
Java home: /root/j2sdk1.4.2_19/jre
Java vesion: 1.4.2_19

They are the same as the one I singlely compile .java source.

Can anyone give me hint why i cannot detect any printer in Centos
tomcat 4.0.3 ?

By the way, I build the class file first in windows (using same java
version, and can detect printers in windows tomcat) and move the
class to centos tomcat. Is it related ?

I see that getPrintServices() mentions being "Implemented by a service
provider, used by the static methods of this class." Your finding
suggests that the PrintServiceLookup class is OS-specific.

<http://java.sun.com/j2se/1.4.2/docs/api/javax/print/PrintServiceLookup.html>

I'm not sure if it would help, but "Files in the [JAR's]
META-INF/services directory are service provider configuration files."

<http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service Provider>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top