Original Post
I am working on my first Java Game and it's almost complete, except that I get an AccessControlException when I try to write to a file. I am not sure how to get the permission...is it with a policyfile or can I do something else? Here is the error: java.security.AccessControlException: access denied (java.io.FilePermission score.dat write) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.SecurityManager.checkWrite(SecurityManager.java:954) at java.io.FileOutputStream.(FileOutputStream.java:169) at java.io.FileOutputStream.(FileOutputStream.java:70) at java.io.FileWriter.(FileWriter.java:46) at Game1945.paint(Game1945.java:392) at javax.swing.JApplet.update(JApplet.java:143) at sun.awt.RepaintArea.paint(RepaintArea.java:169) at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:260) at java.awt.Component.dispatchEventImpl(Component.java:3678) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.EventQueue.dispatchEvent(EventQueue.java:456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) Here is my code that is erroring: try { PrintWriter outFile = new PrintWriter(new FileWriter("score.dat")); for(int x = 0; x < 10; x++) { outFile.println(nameList[x]); outFile.println(scoreList[x]); } outFile.close(); } catch(IOException e){}