PrintServiceLookup cannot find printer/printservice in Centos

C

cyber sana

Dear all,

I use the same statement and can find printservice in windows.
However I cannot find any printer/printservice when use the same code
in Centos


PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(null, null);
System.out.println("pservices.length: " + pservices.length);



-> the pservices.length return zero in centos
but i already added two printer (same physical printer) in centos and
can printout something.
/usr/bin/lpstat -v
device for HP3010: smb://ABC.COM/HP_Server/HPLJ3010
device for HP3010Local: smb://ABC.COM/192.168.5.10/HPLJ3010


Any method to trace why there is no printservice exist ?
Thanks.
 
C

cyber sana

I just found this is because java version 1.4.2 not working well.
I tested the same code in java 1.6 and it works.

Any method to make it running in Java 1.4.2 ? As whole my application
is made of 1.4.2

Thanks.




cyber sana said:
Dear all,

I use the same statement and can find printservice in windows.
However I cannot find any printer/printservice when use the same code
in Centos

PrintService[] pservices =
PrintServiceLookup.lookupPrintServices(null, null);
System.out.println("pservices.length: " + pservices.length);

-> the pservices.length return zero in centos
but i already added two printer (same physical printer) in centos and
can printout something.
/usr/bin/lpstat -v

device for HP3010: smb://ABC.COM/HP_Server/HPLJ3010
device for HP3010Local: smb://ABC.COM/192.168.5.10/HPLJ3010

Any method to trace why there is no printservice exist ?
Thanks.
 
L

Lew

Please do not top-post.

cyber said:
I just found this is because java version 1.4.2 not working well.
I tested the same code in java 1.6 and it works.

Any method to make it running in Java 1.4.2 ? As whole my application
is made of 1.4.2

There's nothing in the Javadocs I see to explain that. It should have worked
in Java 1.4.

Just out of curiosity, why are you stuck with such an ancient Java version?
 
N

New Java 456

Please do not top-post.




There's nothing in the Javadocs I see to explain that.  It should have worked
in Java 1.4.

Just out of curiosity, why are you stuck with such an ancient Java version?

Also, does the Java 1.4 code work with the java 1.6 VM? If so, you
can run with the Java 1.6VM if you include the rt.jar. Conversely, you
can build with the 1.6 javac and target 1.4 VM's. I'd doubt that would
help but could try it in case the problem is in the library code and
not the VM.

I've worked some major company where they are still usign Java 1.4
today. The claim is tis too much red tape to update their production
environment. This same company still has major systems running on VB6
too which is EOL. so, old dogs don't die I guess. Never mind java 1.6
VM might be 75% faster than java 1.4 VM in addition to much better
error handling. I think some versions of Oracle might be stuck at java
1.4 also for their internal stored procedures. Not sure about this one
but that's the version I saw on their systems.

Sorry to stray off topic. I haven't seen any such print problems in
Linux (Fedora and Ubuntu mostly) but don't print much myself.

Tim
 
L

Lew


Please do not quote sigs.
Also, does the Java 1.4 code work with the java [sic] 1.6 VM?  If so, you

Unless it contains 'enum' as an identifier, Java 1.4 code runs under
the Java 6 VM.
can run with the Java 1.6VM if you include the rt.jar. Conversely, you

You don't need to include the rt.jar when you are moving to a later
Java version.
can build with the 1.6 javac and target 1.4 VM's [sic]. I'd doubt that would
help but could try it in case the problem is in the library code and
not the VM.

Which library code? I don't think the Java API is the problem here.
I used 'PrintServiceLookup.lookupPrintServices()' back when I was
programming under Java 1.4 and it worked just fine then.
I've worked some major company where they are still usign Java 1.4

Haven't we all? This might or might not be why the OP is stuck on
1.4. I guess we'll have to wait for them to answer my question to
find out.
... old dogs don't die I guess. Never mind java [sic] 1.6
VM might be 75% faster than java [sic] 1.4 VM in addition to much better

Never mind Java 6's better semantics, more robust memory model, more
robust API, additional syntactic features, not being obsolete, ...

OP: You will probably have to supply an SSCCE <http://sscce.org/> for
us to help you. The information you have given so far indicates that
there should be no problem, so the problem must lie in the information
you have not given so far.
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top