PrintServiceLookup in Tomcat 4.0.3 / Centos 5.3

Discussion in 'Java' started by cyber sana, Jun 25, 2010.

  1. cyber sana

    cyber sana Guest

    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.
    cyber sana, Jun 25, 2010
    #1
    1. Advertising

  2. In article
    <>,
    cyber sana <> wrote:

    > 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%20Provider>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
    John B. Matthews, Jun 25, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carlos Oliva
    Replies:
    0
    Views:
    1,689
    Carlos Oliva
    Oct 20, 2004
  2. rbt

    Python RPM and CentOS

    rbt, May 16, 2005, in forum: Python
    Replies:
    2
    Views:
    367
    Ken Godee
    May 17, 2005
  3. nat
    Replies:
    0
    Views:
    486
  4. CentOS and redhat

    , Jun 22, 2007, in forum: C Programming
    Replies:
    10
    Views:
    633
    Richard Tobin
    Jun 23, 2007
  5. cyber sana
    Replies:
    4
    Views:
    1,037
Loading...

Share This Page