4 Replies Latest reply: Aug 25, 2011 1:36 PM by Bill Wallen RSS

    JNLP Beginner Needs Help

    845111
      Hey guys, I am new here and was hoping someone might be able to help me understand what's going on with this JNLP hocus pocus.

      Basically, I'm just trying to deploy a very simple applet using a .jnlp file. I created the applet in Eclipse and it runs fine in the IDE. I set up my jnlp and html files pretty much exactly how the tutorial on Sun's website suggests, but my stupidity seems to prevent the applet from working inside a browser.

      The files I'm using are all in the same folder. They are:
      HiddenPrizePage.html
      HiddenPrizeTask.jar
      HiddenPrizeApplet.jnlp

      I created my jar using Export in Eclipse with no compression, with the "Export generated class files and resources" checkbox selected. The images folder contains all images used by the applet. The images folder is inside of src. The program is structured so that the logic and drawing is done by HiddenPrizePanel.java and the applet itself is inside HiddenPrizeApplet.java.

      MY HTML FILE:

      <html>
      <body>
      <script src="http://www.java.com/js/deployJava.js"></script>
      <script>
      var attributes = { code:'HiddenPrizeApplet', width:800, height:600} ;
      var parameters = {jnlp_href: 'HiddenPrizeApplet.jnlp'} ;
      deployJava.runApplet(attributes, parameters, '1.6');
      </script>
      </body>
      </html>

      MY JNLP FILE:

      <?xml version="1.0" encoding="UTF-8"?>
      <jnlp spec="1.0+" codebase="" href="">
      <information>
      <title>Hidden Prize Task</title>
      <vendor>Clinical Neuroscience Lab at OSU</vendor>
      </information>
      <resources>
      <!-- Application Resources -->
      <j2se version="1.6+"
      href="http://java.sun.com/products/autodl/j2se" />
      <jar href="HiddenPrizeTask.jar" main="true" />

      </resources>
      <applet-desc
      name="Hidden Prize Task Applet"
      main-class="HiddenPrizeApplet"
      width="800"
      height="600">
      </applet-desc>
      <update check="background"/>
      </jnlp>


      When I try to run the applet inside of a browser, nothing happens. I can right-click the blank space on the page where the applet should theoretically be appearing and choose "Open Java Console" to check for error messages, so I did, and it says:

      load: class components.HiddenPrizeApplet not found.
      java.lang.ClassNotFoundException: components.HiddenPrizeApplet
      at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
      at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
      at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
      at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Exception: java.lang.ClassNotFoundException: components.HiddenPrizeApplet
      load: class components.HiddenPrizeApplet not found.
      java.lang.ClassNotFoundException: components.HiddenPrizeApplet
      at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
      at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
      at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
      at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
      Exception: java.lang.ClassNotFoundException: components.HiddenPrizeApplet