title: Signed applet loading signed jar reading file error
body: <p>I'm working on a game at the moment and have made a JFrame loader which can load the game from the user.home directory, but recently decided I wanted it in a web applet as well.</p>
  
  <p>When I run the JFrame loader it successfully loads the game, checks the file and opens. (both game and JFrame are signed)
  I can load and invoke the method from the Applet fine using:</p>
  
  <pre><code>m.invoke(null, (Object) new String[]{textPack, font, currVersionStr,saveDir}, null, null, this);
  </code></pre>
  
  <p>But then the following error occurs when the Applet tries to load it, it manages to load the game fine but when it tries to load the saved options with the code:</p>
  
  <pre><code> File f = new File(OS.saveDir + OS.fileSeparator + "Options.keys");
      if (!f.exists()) {
          try {
              f.createNewFile();
              saveKeys();
          } catch (IOException ex) {
              Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
          }
  </code></pre>
  
  <p>It gives me the following error:</p>
  
  <blockquote>
    <p>Mar 14, 2013 11:10:21 PM core.GameEngine run SEVERE: null java.security.AccessControlException: access denied
    ("java.io.FilePermission" "C:\Users\Jake.Zombies\Options.keys"
    "read")   at java.security.AccessControlContext.checkPermission(Unknown
    Source)   at java.security.AccessController.checkPermission(Unknown
    Source)   at java.lang.SecurityManager.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkRead(Unknown Source)  at
    java.io.File.exists(Unknown Source)   at
    core.Configuration.loadKeys(Configuration.java:123)   at
    core.Configuration.onStartup(Configuration.java:105)  at
    core.GameEngine.run(GameEngine.java:76)</p>
  </blockquote>
  
  <p>With line if(!f.exists())  being Configuration.java:123</p>
  
  <p>My problem is  it loads fine in the JFrame loader (signed) but not the Applet (Signed)</p>
  
  <p>Any help is much appreciated, thanks.</p>
  
  <p>EDIT: The applet loader checks for files, and can download newest ones fine. It's only when I then ask the game that I load, to load files it encounters problems.</p>
  
  <p>Edit 2 (full loading code):</p>
  
  <pre><code> File folder = new File(saveDir);
          URL u = new URL("jar:" + folder.toURI().toURL() + "Zombies.jar!/");
          URLClassLoader ucl = URLClassLoader.newInstance(new URL[]{u});
          Class c = Class.forName("Visual.GameDisplay", true, ucl);
          Method m = c.getMethod("main", String[].class, String[].class, java.sql.Connection.class, Component.class);
          m.invoke(null, (Object) new String[]{textPack, font, currVersionStr,saveDir}, null, null, this);
  </code></pre>
  
  <p>Writes by just getting a buffered input stream, then writing it to a bufferedoutputstream.</p>