Access denied to print to printer for Windows in Windows 7
I developed the Java POS system about 11 years ago, which still works today on Windows XP and Vista computers. I am currently upgrading them to Windows 7 and am now having printing problems with Star Micronics print printers.
Here is a line of code that works fine on Windows XP and Vista when they access shared printers on other computers on the network, but I get java.io.FileNotFoundException (Access Denied)
when I try to print to a printer connected to Windows 7 Window.
FileOutputStream fos = new FileOutputStream("\\\\machine1\\printer");
Now, in this scenario, machine2 (it doesn't matter if it's Windows XP, Vista, or 7) tries to print to the receipt printer attached to machine1 (Windows 7) through my Java program. If I try to print a plain text file from Notepad from machine2 to machine1 it works fine. It's only through my Java on the line mentioned above that it fails. Once again, if machine1 and machine2 are either Windows XP or Vista, then no problem and this has worked for 11 years.
I believe this is a Windows 7 permissions issue, but I'm not sure what it is. Remember that the second machine can see the printer on the Windows 7 machine and even print to it. Only in my Java program where this fails. I could try to rewrite the old code for the way I type, but I'm afraid I'll run into similar problems.
Any suggestions?
source to share
I had the same problem today, after upgrading for people running Windows XP computers with printing to computers running Windows 7. I couldn't even run "echo test> \ machine1 \ GenericT", got access "Denied".
I found that you need to grant security access to the printers folder located in the "C: \ Windows \ System32 \ spool \ PRINTERS" folder, you must add "Everyone" and give it Modify. This you will not be able to print without problems.
source to share