tags:

views:

211

answers:

2

hello, i need to know that how can we change java.policy file for applet printing. as printing is not supported in java applets by default. i want to print from applet. and i am using PrintServiceLookup.lookupDefaultPrintService() method and it returns null to me.

please send me the solution with reference and sample code.

Thanks. Babar

A: 

Depends where you need to use that applet. If you need only one single workstation then you are better of running it as application instead of an applet.

If it is feasible you can also deploy a matching policy on every client machine or use a signed applet.

Here a few relevant links

Java Plugin Guide -> especially Part III

signed Applets : Java Glossary

Java Tutorial Signed Applets -> somewhat dated tutorial

Default Policy Implementation and Policy File Syntax -> all you could possibly want to know about policy files and how to make them

jitter
i need to use applet instead of application, because its my requirement.do u know the entry for enable permission for printing for applet.
Muhammad Babar Nazir
A: 

When you attempt to print from applet, the user should be presented with a dialog asking to print. IIRC, if denied a SecurityException will be thrown as usual.

Tom Hawtin - tackline