6 Replies Latest reply: Jun 12, 2012 10:07 AM by gimbal2 RSS

    Java 7 on Windows 7, Next-Gen Plugin, File URI

    934852
      I have a Java Applet that does not work in the Java 7 Next Generation Plugin, and I want it to work. I load pre-installed JAR files from the client Windows 7 desktop because they load faster this way rather than over shoddy, often unreliable networks at my location (don't ask). The Java 7 Next-Generation Plugin, however, does not seem to like the file:/// directive for referencing JAR archives.

      For example, my simplified index.html:

      1 <html>
      2 <body bgcolor="white">
      3
      4 <applet
      5 code="TestApplet.class"
      6 archive="file:///C:/tmp/SignedTest.jar"
      7 width="900"
      8 height="600"
      9 >
      10 </applet>
      11
      12 </body>
      13 </html>

      This Applet is self-signed and I've even got a policy file in my home dir granting all permissions to Java. This is the exception I get:

      Java Plug-in 10.3.0.5
      Using JRE version 1.7.0_03-b05 Java HotSpot(TM) Client VM

      ExitException[ 3]java.lang.SecurityException: Permission denied: file:/C:/tmp/SignedTest.jar
           at sun.plugin2.applet.Applet2Manager.loadJarFiles(Unknown Source)
           at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)

      I'd really like to use the Next Generation Plugin as that seems to be the direction Oracle is forcing us to go in, but I like having freedom to load archives from the desktop, especially in an Enterprise environment where we control the desktop.

      Anyone know a workaround to this?
        • 1. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
          EJP
          Doesn't the archive have to be a relative URI? Relative to the directory holding the HTML?
          • 2. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
            934852
            Well that didn't use to have to be the case, and I'm a bit miffed it seems to be enforced now. If I uncheck the use the the next-gen plugin, all works as I want it to; the next-gen plugin seems to want to rob me of my implementation freedom. Sign of the times?
            • 3. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
              934852
              I have recently found that using the applet caching mechanisms described here:

              http://docs.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/applet_caching.html

              ...can allow your applet to perform just as well when JAR files are loaded from the server (using the next-gen plugin), as when loaded from the file system (when not using the next-gen plugin).
              • 4. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
                EJP
                Well that didn't use to have to be the case
                The rule has been there since at least 1997. Whether browsers enforced it or not is another question.
                Sign of the times?
                Sign of complying with a 15-year-old specification. The next-generation plugin has been out for about five years too so I don't know what times you would be referring to.
                • 5. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
                  934852
                  I'm referring to today, actually. In the Java 7 Plugin on Windows 7 using IE 8, if the Next-Generation Plugin is NOT used, it is possible to use the file:/// protocol in the archive parameter to load local JAR files in an applet tag, even when the HTML describing this markup is loaded from a web server somewhere. When the next-generation plugin is checked, it seems the JAR files can only be loaded using HTTP.

                  I'm sure I'm not the only one that finds this a bit confusing, especially as we've been using file:/// to load local JAR files for at least 5 years in our application. Now we would like to use Java 7 and the next-gen plugin as that seems to be what all the cool kids are using, but it introduces additional complexity and slowness that tend to make me seriously wonder if Java Applets are worth bothering with, 'Next Generation' technology or not. Maybe it's just me and my own ignorance, but that's why I'm here asking for information...
                  • 6. Re: Java 7 on Windows 7, Next-Gen Plugin, File URI
                    gimbal2
                    931849 wrote:
                    that tend to make me seriously wonder if Java Applets are worth bothering with, 'Next Generation' technology or not.
                    They're not and haven't been for a very long time. Why people other than game developers have bothered with them for so long has always puzzled me. I'd rather webstart a Swing application than use a bloody applet. JavaFX 2 is the new hot thing where Java in a browser is concerned in any case, its time to finally let Applets become a bad memory.
                    if the Next-Generation Plugin is NOT used, it is possible to use the file:/// protocol in the archive parameter to load local JAR files in an applet tag
                    Seems like somewhat of a security hole to me that you can actually run stuff from the local machine, assuming you're still linking to it in a resource loaded through the internet. Especially because in this case we're talking about an actual program and not just something as silly and usually harmless as an image (not counting any exploits in PNG libs).

                    Good thing that the next-gen plugin no longer allows it.