Add /QIBM/ProdData/OS400/Java400/ext/ibmjps.jar to your class path.

Then the javax.print.* stuff should work.

Try this:

import javax.print.DocFlavor;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;

public class Printers {

* @param args
public static void main(String[] args) {
PrintService defaultPrintService;
defaultPrintService =

System.out.println("DEFAULT PRINTER:");

PrintService[] services;
services = PrintServiceLookup.lookupPrintServices(null,

System.out.println("PrintServiceLookup found " +
+ " printers");

for (int i = 0; i < services.length; i++) {
PrintService service = services[i];
System.out.println("PRINTER " + i);

private static void describe(PrintService printService) {
if (printService == null) {
System.out.println("null argument passed");

System.out.println("Name: " + printService.getName());
DocFlavor[] flavors = printService.getSupportedDocFlavors();
for (int i = 0; i < flavors.length; i++) {
DocFlavor flavor = flavors[i];
System.out.println("F " + flavor);

Class[] categories =
for (int i = 0; i < categories.length; i++) {
Class class1 = categories[i];
System.out.println("A " + class1);




-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Bailey
Sent: 10. oktober 2011 12:53
To: JAVA400-L@xxxxxxxxxxxx
Subject: Printing from Java


I am trying to print a PDF using Java called from RPGLE. I know there are
all sorts of problems with PDF printing but I think I have a potential
solution in using the PDFRenderer package from Sun. The problem I am
currently having is that the java.awt.print.PrinterJob.getPrinterJob()
method is returning a nullpointer exception.

I'm thinking that I am going about this all wrong as AWT is not really
implemented properly on the iSeries. What iSeries print options are
available through java400? Can I send a spooled file to (or even use) an
OUTQ at all? Or is that side of things totally disconnected when using Java?



This email transmission and any files with it are strictly
confidential to the intended recipient and may be legally
privileged. Any views or opinions presented are solely
those of the author and do not necessarily represent those
of BHSF. If you are not the intended recipient, you must
not copy, disclose or distribute its contents in any way.
If you have received this e-mail in error, please notify
the sender and delete the e-mail from your system.

We have taken steps to ensure this e-mail and attachments
are free from any virus but do not accept any
responsibility once this e-mail has been transmitted. You
should scan any attachments for viruses.

No contract may be concluded on behalf of BHSF Limited by

Registered Office:
BHSF Limited
Gamgee House, 2 Darnley Road, Birmingham B16 8TE.

Registered in England number 35500.

BHSF is authorised and regulated by the Financial Services

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.