Hi,
I need to create an
applet that will print to a local printer. From what I have read I need a signed applet. I have managed to get a signed applet to work to allow me to write a file to my pc, but when attemting to read a file via FileInputStream I get:
Error: java.security.AccessControlException: access denied (java.io.FilePermission c:\Ticket.txt read)
The code I'm using is:
FileInputStream fis = new FileInputStream("c:\\Ticket.txt");
printStatus( new DataInputStream(fis).readLine());
fis.close();
I added this to my java.policy file:
grant signedBy "mySigner" {
permission java.io.FilePermission "C:\Ticket.txt", "read";
};
I read somewhere that FileInputStream should not be used when reading from the client but don't know what else to use.
Right now, I'm simply trying to read a text file and send it to the printer. What I ultimately would like to do is send a stream of text directly to the printer without a file. I'm completely new to
Java so I've been doing lots of reading online to see that some people have been able to do similar things but have yet to find any good material to point me in the right direction.
If anyone has any information that can point me in the right direction I would greatly appreciate it.
Thanks,
Keith