Unable to specify printer for print jobs in Java7 for OSX

Hi, I'm developing a simple software that would monitor a folder for new documents and print them automatically. Monitoring the folder was the easy part with WatchService in Java7, but I'm running into problems with printing. Namely, I'm using java.awt.print.PrinterJob to print the document, but the print job is always sent to the default printer, instead of the printer that was specified.
PrinterJob pPrinterJob = PrinterJob.getPrinterJob();
PrintService[] psArr = PrinterJob.lookupPrintServices();
for (PrintService ps : psArr) {
if (ps.getName().equalsIgnoreCase(specifiedPrinterName)) {
pPrinterJob.setPrintService(ps);
break;
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
//specify print attributes....
pPrinterJob.print(pras);
The code looks simple enough, and calling getPrinterService() returns the intended printer after specifying it using setPrinterService(). However, regardless of the printer specified, the print job is still sent to the default printer. Tried on both Java 7 Update 4 and Update 6 for OSX with the same result.
Update: Got my hands on a Win XP machine and tried out the same piece of code using Java 7 Update 6 for Windows. Guess what, the print job was sent to the specified printer! I'm pretty sure this is an OSX specific issue now. Has anyone come across this issue previously?

Hi,
I have the exact same problem on OS X 10.8.2 with Java 1.7.0 Update 21.
When I call PrintServiceLookup.lookupPrintServices(null, null) I get three distinct printers, but no matter which of the three I specify, the print job is sent to the default printer.
The code works as expected when tested on Windows and Linux machines.
Any help is appreciated!

Similar Messages

  • CS4 : unable to print / stops printer / halts print job on Fuji Xerox c2255

    Morning,
    This discussion posting may or may not have some relevance to my previous posting, CS4 : memory leak errors (?) in Os X console log
    I am working on a clients workstation and they are having a few problems. Specific hardware and software details are at the bottom of this posting.
    THE PROBLEM
    The problem is that I can not seem to print from CS4. The problem seems to be specifically Adobe CS4 related as I will explain below.
    From the end user perspective, the CS4 suite appears to function normally with one exception - CS4 will not print. In the below example, I am referring to mainly Adobe Acrobat CS4 and InDesign CS4 as these are the programs that they use the most. The artist can still work with all the CS4 applications - opening new or existing indesign/acrobat documents, adding text, import, export, create pdfs, saving to same name or new name, etc... but they can't print out to a printer (Fuji Xerox c2255). For example, using InDesign, the artist can open an existing Indesign document and make changes to the Indesign document. She can save the document using the same name or a new name, but when she attempts to print the Indesign document, the document will not printed. If she saves the file as a pdf and using Acrobat to open the pdf and attempts to print the document, it will not print. BUT, if she uses preview to open the document and attempts to print, then it WILL print.
    When attempting to print, the following happens,
    - in acrobat CS4 or Indesign CS4, choose 'Print'
    - choose A4 or A3 format
    - click print
    The job processes and is set to the printer spool as per normal. About a couple of second later, after the processing is done, the Printer Queue starts jumping up and down in the dock. Open up the printer queue, shows the following message 'Printer has stopped'. The job is present in the printer queue list. Restart the Printer, and restart the job, and then about 5 seconds later, the message appears again, 'Printer has stopped'. This continues ad nauseum until the job is manually deleted from the queue. No print outs.
    PRINTER or PRINTER DRIVER
    I have installed and uninstalled the printer driver half a dozen times. I have source the driver from different locations (US, Asia and Australia). In all three cases,the Fuji Xerox printer drivers look identical (I've opened them up in text edit). Every other application, on the Mac, appears to access the printer without any problems -Office 2008 ( Word, Excel), Preview, Text Edit, Text Wrangler, Mail, etc can all address the printer and print to the printer without any problems. Using any of these programmes, I can access all the functionality of the printer (A4 in Tray 1, A3 in Tray 2, Levels of the inks, etc) via the driver. When I installed the generic printer drive, I have no access to any of the Fuji Xerox Printer functionality. This leads me to think that the Fuji Xerox printer driver is not the problem.
    Interestingly, using Apple's Preview, I can print any existing Acrobat documents without any problems - in either A4 or A3. However, if I attempt to print the SAME Acrobat document from Acrobat CS4, it will not print.
    USE 'PRINTER DRIVER' option rather then choosing paper size.
    I read in another posting, in the Adobe forum, of a similar problem with Duplex printing - if the the paper size is manually set (A3/A4) in the 'print document options', printers do not print duplex. The answer seemed to be instead of manually choosing the paper size (A4/A3), allow CS4 to determine the paper size. So, in the 'print document' dialog option, one should choose 'use printer driver' instead of specifying A3 or A4. An explanation suggested that the print engine refers to the printer driver to find out what options are availible and then CS4 chooses what size it wants to send the print job to. Forcing CS4 seems to stop duplex printing from working.
    I will look at this suggestion next week when I return to the site.
    NETWORK PRINTER
    The fuji Xerox c2255 is a network printer. Both Mac Pro and printer have a fixed IPs. I have eliminated the network as a problem, by running a network cable directly from Mac Pro ethernet port to Fuji Xerox ethernet port. I can ping the printer directly from the Mac Pro; I can see the printer from the Mac. I can print directly to the printer from the Mac, using Text edit or any other application EXCEPT CS4. CS4 will not print.
    CLIENT HAS UPDATED ALL DOCUMENT FILES TO CS4 via INX
    I have since been informed that a staff member had (recently) updated all the documents to CS4 via INX. I wonder if this anything to do with the problems ? Unfortunately, I don't have any 'old' documents to test with. I wonder if the conversion process had 'modified' the pdf wrapper in some way ? I have tested this in the following manner - I opened a 'updated' CS4 document in Indesign CS4. If I try to print straight out of CS4, then the above problem occurs (i.e. the document will not print as descibed above). BUT, if I copy all the contents - from the updated CS4 document - and paste the contents directly into a NEWLY created document, then it WILL print.
    UNINSTALL CS4 AND REINSTALL
    Yes, this has been done three times so far with no further improvement. Each time, the steps that I have taken are as follows,
    - repaired disk permissions.
    - fsck in single user mode to confirm directory structure is fine
    - uninstalled CS4 using the uninstaller.
    - manually searched and remove any file, folder, cache that has the word 'adobe' in it from both User account, System Library and Library.
    - used Onyx manual and automatic functions to clear all logs, font caches, spotlight databases, kernal caches, etc, etc
    - ZapRAM Cmmd-Option-P-R (wait for start up chime 3 times)
    - fsck again
    - start Mac in Safe mode
    - reinstalled CS4 from media (see version above)
    - Following reinstallation, restarted mac as per normal.
    - run Disk Utility to repair permissions
    I have tried printing an existing CS4 document file with a freshly installed CS4 suite - directly from the media file (will not print). And I have attempted to print a CS4 document file after applying all updates (will not print) Neither approach improves the situation.
    USE CS3
    This has been considered but as the client(s) have already done the conversion of all their documents to the CS4 format using INX, then they are really committed to working with CS4. What I am attempting to do at this time is to find out WHY CS4 is doing what it is doing, and if there is a fix to this problem. If there is no fix, then I know I should use a different approach.
    I am posting this message in the hope that someone may have already come across this problem or perhaps may be able to spot something that I have overlooked. This problem has really got me stumped - I have had experience with Adobes products since Photoshop 1.0 (1990s / Pre-CS1) but never had a problem as annoying or time consuming as this one - this is a dousy.  I have lodged a case number with Adobe Technical Support.
    Thank you for taking the time to read this longish posting. I would be most grateful for any feedback solutions, or suggestions.
    Have a wonderful weekend.
    Thank you,
    Fred
    Workstation specs are as follows,
    MACINTOSH MODEL (Intel) 8 core - new model Mac Pro; just 1 month old.
    Model Name: Mac Pro
      Model Identifier: MacPro4,1
      Processor Name: Quad-Core Intel Xeon
      Processor Speed: 2.26 GHz
      Number Of Processors: 2
      Total Number Of Cores: 8
      L2 Cache (per core): 256 KB
      L3 Cache (per processor): 8 MB
      Memory: 6 GB
      SMC Version (system): 1.39f5
      SMC Version (processor tray): 1.39f5
      System Version: Mac OS X 10.5.7 (9J61)
    ADOBE CS4 VERSION - Installed from media.  No updates applied (but have already done with with an earlier installation)
    Adobe Acrobat Pro 9.0 v9.0.0, Adobe Bridge CS4 v3.0.0.464, Dreamweaver CS4 v10.0.0.4117, Adobe Flash CS4 v10.0.0.544, Adobe InDesign 6.0.3.557, Adobe Media Encoder CS4 v4.0, Adobe Media Player v.11, Adobe Photoshop CS4 v11.0 (11.0x20080919 [20080919.r.488 2008/09/19:02:00:00 cutoff; r branch]), Adobe Updater 6.0.1.1464

    Try resetting the printer subsystem.

  • Unable to print to Win Server2008 R2 queue from Lion10.7.2, printer status gets paused or asks username and password for printer

    Hi Everyone,
    I have set up a print queue for HP CP5225dn on Win Server2008 R2 on a shared domain . When I install a print driver on Mac 10.7.2 Lion it sometimes ask for a 'user name & password' for the printer which has not been set by us on the printer.
    Second issue I don't know how it reached to the point that I was able to send the job through but as soon as it starts to connect to the printer 'it turns the status to printer paused' or can't connect to the printer.
    Printer works well on 'Bonjour' printing so I don't have any doubts on the printer driver. But HP doesn't have the drivers for CP5225dn for Lion 10.7.2.
    I have to configure the printer via the queue. Please advise any workarounds.
    Thanks
    Yezdi

    This easy to follow procedure (5 web pages with screen shots) worked for MacBook Pro 10.6.8 via Wireless-N to Windows 7 Home Premium SP1 x64 using USB Cable to HP Officejet 7210 All-in-One.  This configuration had worked with Windows XP.
    http://macs.about.com/od/printersharing/ss/Printer-Sharing-Share-Your-Windows-7- Printer-With-Your-Mac.htm
    Error messages encountered prior to using the above procedure:
    authorization required
    Backend returned status 2 (authentication required)
    Cannot find server
    Communication Failure: The computer is no longer able to communicate with your printer
    cupsdAuthorize: pam_authenticate() returned 9
    getaddrinfo: <windows printserver> nodename nor servname provided, or not known
    Job held for authentication
    On Hold (Authorization required)
    pam_authenticate() returned 9 (authentication error)!
    Printer Paused
    Printer stopped due to backend errors
    Session setup failed: NT_STATUS_INVALID_PARAMETER
    snmpInk: Unknown host (<windows printserver>)
    This computer seems to have a working Internet connection. but we cannot find "<windows printserver>" You may have typed the address incorrectly.
    Tree connect failed (NT_STATUS_ACCESS_DENIED)
    Unable to locate printer
    Unable to locate printer Unknown host
    Unknown host

  • Message "waiting for job to complete..." for printing

    Hello,
    I have a printer installed on Windows Server 2008 R2, shared for a
    windows 7 computer (OK), and a Macbook Air 10.8.3. m.lyon. (KO) is installed and configured correctly. HP Deskjet 3940.
    But in the MacBook when I print any document send the form to the
    Windows tail, and appears well in line, even tells me not just printing but printing ever, life is printing but printing out the document, including the correct printer makes noise as to be printed but nothing .
    On the MacBook print queue the message remains "printing: waiting for job to complete ..." and never complete.
    I install the printer on the Windows icon in Printers & Scanners for smb
    for the default printer and the result is always the same.
    Connect the printer directly to a USB port on the MacBook to try and charge good drivers and printed the first ....
    I need help, can you help,
    thanks,
    Joan.

    I solved this as follows....
    Go to the Windows computer.
    Open printers and select the printer
    Go to Customize your printer
    Go to ports
    Disable "Enable Birectional Support" in the Ports
    Sounds crazy, but it worked.
    Good luck, YMMV.

  • HP LaserColor 3550 : printing jobs just hang for no apparent reason

    On an iMac G5 I administer at work an HP Laser Color 3550 was recently installed by a professional from the store. It did one printing job just to please the technician and then, later, when someone else tried to print, the job just hung! I should perhaps add that it's a multi-account machine which I administer but personally don't use, apart from checking it out.
    I spent a long time deleting and re-adding the printer in Printer Setup and repairing permissions.
    I installed and reinstalled the driver and HP toolbox from the HP site and, when I realised that no extra installation was in fact required in Tiger, became worried that my having done this installation was what was causing the problem.
    I also used Printer Setup Repair to repair specific permissions. This came up with a message saying a CUPS file was missing which it couldn't repair (sorry, I didn't note the detail and I'm not on the same machine at the moment).
    I've read some of the posts here with look-alike problems and noted down the steps that Greg Sahli has recommended. But I'm wondering whether I shouldn't go directly to a Combi re-update?
    I'd be very grateful for any help!
    Mike
    imac G5 2mgz Mac OS X (10.4.3)
    imac G3 600

    Mr or Ms Light,
    No, I don't think it's an OS problem. Printing on the Mac is nightmarishly complicated (under the hood), and HP installs its own system that bypasses the default FreeBSD system. This is an occasional problem with my HP 5550. HP claims to have good user support.
    I've had, regularly, the exact symptoms. I've a migraine now, so I can't remember what I do about it. But it would be typical of me to press the printer button off, then clear the queue, then turn on the printer and have it remove the paper still in it. If needed, I might restart the computer.
    As for the cause, for the last 10 minutes I've been asking my 4-year old granddaughter, but she's not in the mood to tell me. However, she often prints pictures of Elmo off the internet to color, and she captures parts of screens and prints them. This is with the USB cable disconnected; and its when I reconnect it, the exact symptoms you describe occur.
    Try the above, and I may be able to give you a definitive answer later, after my granddaughter's nap.
    Bruce

  • Problem with getting specified pages for printing

    requested Sir,
    I am sanjeev, presently working with adobe indesign for publishing.
    i am working verious sets of master pages,
    now have a problem go gate specific pages for print in the same software.
    it shows saction name that i could not inditify
    give me the message
    (one or more of th pages specified are not valid page name)
    so how gate the valid name of pages?
    please slove my problem,
    thanks
    sanjeev

    If your document has more than one section (sections are used to restart page numbering and similar tasks) you can identify the pages using either the logical name, which uses the section prefix and the "logical' page number which is the number that appears in the page marker, or you can use the absolute page number, which is the position in the document. You can set your preferences to display section or absolute page numbering in the Pages panel, too.
    Unless you assigne some other prefix, sections are labeled as Section I, Section II and so on, and pages are designated by Section:Page# in the dialogs. If you want to use absolute page numbering in the dialog instead, you can add a + sign in front of the page number in the dialog: +6-+12 will be the sixth though twelf pages in your document, even if they are in different sections and carry the numbers vi - 4, for example.

  • MAC OS 10.9   some users cannot print to new Ricoh MP C6502   print job is holding for authentication and cannot figure out why

    I have a few IMAC and G5 users who have OS10.9 who cannot print to a new Richoh MP C6502, I downloaded and installed the new PS driver and it works on some systems but I have 3 people that goes right to Hold for Authentication.   I tried deleting everything associated with this in keychain access and after I did this it comes up to enter a password and it accepts the network login credentials but still holds the print job.  I even tried using guest as login and password as someone suggested but still cannot print any ideas on why?

    I apologize for the delay in responding to you.  I was on the road all day yesterday.
    OK.  I switched the printer's Ethernet cable to a Linksys Switch (Model EZX S55W) that's part of this local network.  That did not work.  I swapped out the cable for one that I know works.  Still no change.  I switched the printer's Ethernet cable directly to a port on the router.  No change.  I even swapped cables here, too, but no success.
    As I was doing all this, I was wondering: When I select the HP P1606dn printer in the Print and Fax "Add" dialog box, (see the image below) and the Print Using pulldown menu displays "Please select a driver or printer model" and the message "Searching for new drivers" appears under it (with the spinning wheel), why is it that the Ethernet connection to printer is critical to "finding" a new (printer) driver?
    Isn't the utility searching through my system and libraries looking for a printer driver app for the printer that I identified/selected in the dialog box?  
    After all, if the dialog box lists the printer among those to choose from, hasn't the utility already discovered the printer via the Ethernet connection?

  • Received a print confirmation for a job I didn't order

    I received a "ePrint Job Received" email for a job I know nothing about.
    The email came to me from a catchall address of a domain I have:
    [email protected]
    I don't know what to do about it, I don't want to be billed for anything, and I have no idea how ePrint works, or how you would have billing information for me anyways.
    Please advise.

    What is ePrint?
    HP ePrint is a free service that allows you to print documents and photos from any mobile or network-connected device (such as a phone, laptop, tablet, or other mobile device) to your HP ePrint-enabled printer. Each HP ePrint-enabled printer has its own unique email address. After you enable HP ePrint on your HP ePrint-enabled printer, you can print from your mobile or network-connected device by sending an email to your HP printer's email address. With HP ePrint, you can print from anywhere, at any time. If you can send an email, you can use HP ePrint.
    Source: Getting Started with ePrint

  • What monitors are currently most appropriate for print jobs?

    Hi, I'm a free lance graphic designer for 20 years already and have always used Aperture Grid CRT Trinitron monitors as the most accurate for creating color jobs for print. I bought my last set of monitors Sony's Multiscan G420 in 2001. While they are still pretty accurate, they are aging and I'm thinking of buying new monitors. At that time - 2001, when I purchased my monitors there were a few other technologies like Shadow mask and LCD which were not good at all for creating graphic design color jobs for print.
    I'm not sure if they still sell Aperture Grid CRT monitors anymore and would like to find out what monitors/monitor technology is currently most appropriate for print jobs?
    I will greatly appreciate your tips.

    I'd go with a Sony, Samsung, or Sharp LCD and use it as a monitor, then professionally calibrate it.
    Viola, you have quality, resolution, saturation, accuracy, dependability, all in one

  • FBU Internal Job Queue Full for Synchronous Processing of Print Requests

    Hello All,
    We are getting a lot of errors in system log (SM21) with the
    Error : FBU Internal Job Queue Full for Synchronous Processing of Print Requests
    User :SAPSYS
    MNO:FBU
    =============================================================
    Documentation for system log message FB U :
    If a spool server is to process output requests in the order they were
    created using multiple work processes, the processing of requests for a
    particular device can only run on one work process. To do this an
    internal queue (limited size) is used.
    If too many requests are created for this device too quickly, the work
    process may get overloaded. This is recognized when, as in this case,
    the internal queue is exhausted.
    This can only be solved by reducing the print load or increasing
    processor performance or, if there is a connection problem to the host
    spooler, by improving the transfer of data to the host spooler.
    Increasing the number of spool work processes will not help, as
    requests for one device can only be processed by one work process. If
    processing in order of creation is not required, sequential request
    processing can be deactivated (second page of device configuration in
    Transaction SPAD). This allows several work processes to process
    requests from the same device thus alleviating the bottleneck.
    Enlarging the internal queue will only help if the overload is
    temporary. If the overload is constant, a larger queue will eventually
    also be overloaded.
    ===========================================================
    Can you please tell me how to proceed.
    Best Regards,
    Pratyusha

    Solution is here:
    412065 - Incorrect output sequence of output requests
    Reason and Prerequisites
    The following messages appear in the developer trace (dev_trc) of the SPO processes or in the syslog:
    S  *** ERROR => overflow of internal job queue [rspowunx.c   788]
    Syslog Message FBU:
    Internal job queue for synchronous request processing of output requests full
    The "request processing sequence compliance" on a spool server with several SPO processes only works provided the server-internal job queue (see Note 118057) does not overflow. The size of this request queue is prepared using the rspo/global_shm/job_list profile parameter. The default value is 50 requests. However, if more output requests arrive for the spool server than can be processed (and the internal request queue is full as a result), more SPO processes are used to process the requests (in parallel), and the output sequence of the requests is no longer guaranteed.
    Solution
    Increase the rspo/global_shm/job_list profile parameter to a much larger value. Unfortunately, the value actually required cannot be found by "trial and error" because this queue contains all the incoming output requests on a spool server, not just the "sequence compliant" requests. A practical lower limit for this value represents the maximum sequence-compliant output requests for the above generated output device. If, for example, 1000 documents that should be output in sequence are issued from an application program to an output device, the queue must be able to hold 1000 entries so that it does not overflow if the SPO process processes the requests at a maximum low-speed.

  • Export file in specified format for printing labels etc (BOnewbee question)

    Hello to all,
    has anyone experiences with generating a export file in special text-format to a directory???.
    Is ist possible to generate this file after some action in BO?? (Printing delivery form and after that generate file for printing barcodelabel in special application???)
    Sorry, but i dont have any programming experiences in BO - only in SAP R/3 with ABAP.
    Thanks in advance for your replies!

    There are a number of ways to do this.  You could use the SDK to trap an event and then automate your barcode printing from .net.  You could also use middleware (iBolt, K2, biztalk, etc) You might also write a SQL DTS job with an associated trigger to save out a text file.
    I guess the answer to your question depends on how big your company is, how spread out your IT resources are and what technical resources you have to dedicate to the project.

  • Err:Internal Job Queue full for synchronous processing of print requests

    Hi,
    We are getting a lot of errors in system log with the
    error :
    Internal Job Queue full for synchronous processing of print requests.
    User :SAPSYS
    MNO:FBU.
    When we check the document in syslog it states it can be solved by reducing the print load or increasing performance or if there is a connection problem to host spooler , by improving the transfer of data to host spooler..
    But not by increasing the no of spool workprocess..
    I think any of the one stated cannot be implemented ..
    Pls provide your valuable answers and if any of the above can be implemented from your end..
    Regds,
    Satyanarayana N

    Hi Vamshi,
             Thanks for your response but would also like to confirm how we can say that spool queue is full and what may be the Max size of spool queue..
    When we say Internal queue is full does it mean spool queue...
    And also when I run the TEmse consistency check it is giving some errors..
    When I check Spool requests there are some waiting process,but when I check Output requests there are only 1 or 2..
    Please provide  me your valuable solution regd this..
    Regds,
    Satyanarayana N.
    Regds,
    Satyanarayana N.

  • One print queue for each job?

    We have customer jobs that last for a year or so. We have a networked HP printer. Is it possible to set up multiple print queues for this same printer, so that we can keep track of which print jobs should be charged to each customer? I can set up a new print queue connected to the printer (although with "Kind" as "Generic PostScript Printer" instead of the printer model) and then I can print to it from the server; and it shows up in the printer list on the client stations (although with a diamond next to it), but when I select it in the Print dialog on the client station I get a spinning beachball and have to force quit e.g. Word. Is this an impossibility, or is there a way to do it?
    PowerMac G5   Mac OS X (10.4.3)  

    At AUC, Dov Issacs posted:
    function(){return A.apply(null,[this].concat($A(arguments)))}
    Beginning with Windows Vista (and also true for Windows 7), the Adobe PDF PostScript printer driver instance must have its Advanced=>Spool Print Documents ... setting to Start printing immediately instead of either of the other settings. The other settings will yield the behaviour that you describe.
    http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=23380
    The "Adobe PDF PostScript printer driver" would be the "Adobe Printer".
    Perhaps a tweak to your installed Adobe Printer to reflect Dov's guidance will resolve the issue.
    Be well...

  • Unable to move print to preview pane for printing in Lightroom 4.Tried deleting agprefs file and restart with no success! Thanks in advance.

    Unable to move print to preview pane for printing in Lightroom 4.Tried deleting agprefs file and restart with no success! Thanks in advance.

    Sorry to bump this - but does anyone have any idea what could be wrong?

  • Texture filter in Rgb mode to cmyk - safe for print job?

    I want to apply the texture filter to a photo for a print job but the texture filter only works in rgb. Can the rgb file be SAFELY converted to cmyk for print?

    In what way do you think a conversion from RGB to CMYK after the application of the filter will not be safe? What do you expect to go wrong?
    ...or if you have tried it, what has gone wrong?

Maybe you are looking for