my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes printerjob, awt headless mode and mac os x server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "printerjob, awt headless mode and mac os x server" Watch "printerjob, awt headless mode and mac os x server" New topic
Author

printerjob, awt headless mode and mac os x server

gianni drughi
Greenhorn

Joined: Jun 23, 2010
Posts: 8
hello
i've an application that print a page using classes like jframe, jpanel, jtable, etc
when i run it on a linux server or on a windows one there are no problems, but when i try to print this page on mac os x server 10.6.8 i get this error:
on system dock appear a java icon named org.apache.catalina.startup.Bootstrap and the printed page comes empty. if i set the visibility property to true i can see the correct page, but i can't print!
I've searched on google and i found various articles that say to set JAVA_OPTS to awt headless = true. i've tryed but i've obtained an headlessexception, because i use jframe etc that need headless mode disactive...so what can i do?

i want to print with a shared network windows printer, if i print with textedit all go well, the problem appears only using java PrinterService class

thanks in advance
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

Assuming you've set the option correctly, can you post us the code that tries to do the printing?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
gianni drughi
Greenhorn

Joined: Jun 23, 2010
Posts: 8
yeah i think i've set the option correctly because i get an headlessException, so this is my code




so at the frame.setVisible(true) i can see the well constructed document, meanwhile with the line pj.print(attr) i print a white paper
any ideas?

thanks for the reply rob
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

You can't display a frame if you have nothing to display the frame on, which is usually the case for servers. If you think the frame will display on the client you're mistaken.
 
 
subject: printerjob, awt headless mode and mac os x server
 
Similar Threads
Jasper Report: Can't connect to X11 window server
Getting errors while trying to get graphics environment
Getting native Open, Save, Page Setup & Print easily
Questions about Import
setting environment variables - Linux