473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PrintServiceLookup -- Not Detecting ANYTHING!

I am working on an install program, for another program that will need a
list of printers on a system. Originally I found the printers by doing
this:

public PrintNames() {
String tName = "";
PrintService[] pServices = PrintServiceLookup.lookupPrintServices(null,
null);
System.out.println("Service count: "+pServices.length);
cPrinter = new String[pServices.length];
for (int i = 0; i < pServices.length; i++) {
tName = pServices[i].getName();
System.out.println("Printer: "+tName);
cPrinter[i] = tName;
}
return;
}

(Of course, this is part of the class PrintNames and I have other methods to
call to get the full list of printers, or a single printer -- cPrinter is a
String[] var, declared elsewhere.)

When I call lookupPrintServices(null, null), the Java Docs say that the
"null" params will avoid restrictions (like asking for something that will
print "text/plain", which could limit the list of printers). I've been
using this class for a while, and it's working fine on a Linux box AND a
Win2k box. The version of Java on the Linux box that is giving me a list
of printers is 1.4.1_02. The version on a Linux box where this DOESN'T
work is 1.4.2_01. (I would think, if anything, it wouldn't work on the
earlier version). I no longer have access to the Win2k system where it
worked, but that should be the same version as a Win2k system where it
doesn't work (1.4.2_01).

I've also tried this with different DocFlavors, but it makes no difference.

In short, I've tried this on 2 Linux boxen and 2 Win2k boxen. It worked on
1 Linux and 1 Win2k, but does not work at all on 1 Linux and 1 Win2k box.

What is going on? Am I doing something wrong, or is there a bug in
1.4.2_01? Is this worth using 1.5? (I haven't upgraded because I didn't
know if it would break anything I'm doing now.) How can I get a list of
printers on a box?

Thanks for any help!

Hal
Jul 17 '05 #1
0 1957

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Jay | last post by:
I'm sure this is a really dumb question, but how do you detect a variable type in Python? For example, I want to know if the variable "a" is a list of strings or a single string. How do I do...
6
by: Matt Hawley | last post by:
I'm facing a problem where I need to verify that my windows forms application has access to the internet before it can do anything. Currently, the only way I can think of is by creating a...
8
by: Matt Hawley | last post by:
I'm facing a problem where I need to verify that my windows forms application has access to the internet before it can do anything. Currently, the only way I can think of is by creating a...
79
by: VK | last post by:
I wandering about the common proctice of some UA's producers to spoof the UA string to pretend to be another browser (most often IE). Shouldn't it be considered as a trademark violation of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.