I want to print applet. There are two ways:
- Signing applet
- Add
permission java.lang.RuntimePermission "queuePrintJob";injava.policyfile
I want to go with second option.
My questions are:
- Where should I add java.policy file?..on client machine or server?
- On server I can add it in startup script but if on client machine then how?
- Can I set permissions in applet code itself?
No, there are at least 3. The two you mentioned (the 2nd of which is impractical for general distribution), as well as the JNLP API based
PrintServiceavailable to embedded applets launched using Java Web Start in a next-generation-plugin JRE. Here is a demo. of thePrintService.I recommend the last one. It does not require the applet to be digitally signed or trusted, instead the user is prompted when the applet goes to print.