problem loading applet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • drsmooth
    New Member
    • Oct 2007
    • 112

    #1

    problem loading applet

    this is rather frustrating...i have tried numerous different things in a futile attempt to get a japplet packaged in a jar file to load on my site.

    everytime i try a new thing i get:

    Code:
    load: class NetCasino.class not found.
    java.lang.ClassNotFoundException: NetCasino.class
    	at sun.applet.AppletClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    	at sun.applet.AppletPanel.createApplet(Unknown Source)
    	at sun.plugin.AppletViewer.createApplet(Unknown Source)
    	at sun.applet.AppletPanel.runLoader(Unknown Source)
    	at sun.applet.AppletPanel.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    	at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    	at sun.applet.AppletClassLoader.access$100(Unknown Source)
    	at sun.applet.AppletClassLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	... 10 more
    could it be wrong with my html?

    Code:
    <p>
    <applet width="955" height="587" code="NetCasino.class"
    									codebase="http://drsmooth.ipower.com/public_html/"
    									archive="netCasino.jar"
    									width="600" height="600">
      You need Java Support to view this page
    </applet></p>
    or perhaps i am compiling it wrong...i use the latest netbeans and basically jus built a basic applet to try with...anyone can visit that and see if theyd liike, but all that is there is an x in a box, and the error i posted above comes when i right click and say open java console...

    any help would be appreciated. i have already googled for hours and found no success

    thanks,
    ken
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Are you sure your archive attribute value can be resolved? There is no
    code base specified so how is it supposed to find your .jar file? Either specify
    an absolute URL for your archive or specify your code base.

    kind regards,

    Jos

    Comment

    • drsmooth
      New Member
      • Oct 2007
      • 112

      #3
      isnt:

      codebase="http://drsmooth.ipower .com/public_html/"

      that the code base?

      that is the path where the jar is, it would be

      http://drsmooth.ipower .com/public_html/netCasino.jar

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by drsmooth
        isnt:

        codebase="http://drsmooth.ipower .com/public_html/"

        that the code base?

        that is the path where the jar is, it would be

        http://drsmooth.ipower .com/public_html/netCasino.jar
        My bad: I missed that line completely because of that funny indentation, sorry.
        I don't know whether or not that codebase is relative to some web server base
        directory. Check it out. If it is, that is not the absolute path to your jar file.

        kind regards,

        Jos (just guessing now)

        Comment

        • drsmooth
          New Member
          • Oct 2007
          • 112

          #5
          im afraid the problem might be in
          Code:
          Caused by: java.io.IOException: open HTTP connection failed.
          	at sun.applet.AppletClassLoader.getBytes(Unknown Source)
          	at sun.applet.AppletClassLoader.access$100(Unknown Source)
          	at sun.applet.AppletClassLoader$1.run(Unknown Source)
          	at java.security.AccessController.doPrivileged(Native Method)
          	... 10 more
          is there some special setup required in the code when you put an applet online?

          if you dont mind taking a peek at my code:

          Code:
          package netcasino;
          
          import javax.swing.JApplet;
          
          /**
           *
           * @author Ken
           */
          public class NetCasino extends JApplet {
          
              /**
               * Initialization method that will be called after the applet is loaded
               * into the browser.
               */
              public void init() 
              {
                  Player p = new Player("Ken");
                  SlotMachine sm = new SlotMachine(p);
                  SlotMachineDisplay d = new SlotMachineDisplay(p,sm);
                  
                  getContentPane().add(d);
                  setVisible(true);
              }
          }
          the slotmachine display is a jpanel and all this stuff compiled and ran when i used a jframe, but now i want to portal the game to the net.

          another update, i was using the wrong path to my jar file, this is my updated html stuff:

          Code:
          <p>
          <applet width="955" height="587" code="NetCasino.class"
          									codebase="/home/users/web/b2263/ipw.drsmooth/public_html/"
          									archive="netCasino.jar"
          									width="600" height="600">
            You need Java Support to view this page
          </applet></p>
          thanks for your help,
          ken

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by drsmooth
            another update, i was using the wrong path to my jar file, this is my updated html stuff:

            Code:
            <p>
            <applet width="955" height="587" code="NetCasino.class"
            									codebase="/home/users/web/b2263/ipw.drsmooth/public_html/"
            									archive="netCasino.jar"
            									width="600" height="600">
              You need Java Support to view this page
            </applet></p>
            Exactly what I thought (see my reply #4): that codebase URL is supposed to be
            an absolute path to your jar, not a path relative to some web server base directory.

            Can you elaborate on what is going wrong now because a JApplet is a JFrame
            because the first class extends the latter. From the code snippet you've shown
            us I can't tell you what the problem(s) might be.

            kind regards,

            Jos

            Comment

            • drsmooth
              New Member
              • Oct 2007
              • 112

              #7
              the problem now remains the same as the problem i had before, now i have just exausted one solution. the error that i posted with is still the same error i am getting.

              i also tested it out in firefox and internet explorer and on multiple computers to the same avail.

              on my girlfriends laptop in firefox i got something slightly different:
              Code:
              load: class NetCasino.class not found.
              java.lang.ClassNotFoundException: NetCasino.class
              	at sun.applet.AppletClassLoader.findClass(Unknown Source)
              	at java.lang.ClassLoader.loadClass(Unknown Source)
              	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
              	at java.lang.ClassLoader.loadClass(Unknown Source)
              	at sun.applet.AppletClassLoader.loadCode(Unknown Source)
              	at sun.applet.AppletPanel.createApplet(Unknown Source)
              	at sun.plugin.AppletViewer.createApplet(Unknown Source)
              	at sun.applet.AppletPanel.runLoader(Unknown Source)
              	at sun.applet.AppletPanel.run(Unknown Source)
              	at java.lang.Thread.run(Unknown Source)
              Exception in thread "Thread-6" java.lang.NullPointerException
              	at sun.plugin.util.AnimationPanel.createTranslucentImage(Unknown Source)
              	at sun.plugin.util.AnimationPanel.createGradientShapeImage(Unknown Source)
              	at sun.plugin.util.AnimationPanel.initBackground(Unknown Source)
              	at sun.plugin.util.AnimationPanel.preloadResources(Unknown Source)
              	at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
              	at sun.plugin.util.AnimationPanel.run(Unknown Source)
              	at java.lang.Thread.run(Unknown Source)
              i wondered if maybe because all the classes were in a package? would that effect the way it finds them? i tried several alterations to the 'code' and to the 'codebase' tryin to think of how the class name might be affected by its package status but it didnt seem to change anything...

              thanks,
              ken

              Comment

              • Nepomuk
                Recognized Expert Specialist
                • Aug 2007
                • 3111

                #8
                A slightly different thought: I use an FTP-Server that has a directory public_html too - but it's not used in the actual http URL. So, it would be something like
                Code:
                codebase="http://nepomuk.whateverdomainitis.com" archive="blabla.jar"
                instead of
                Code:
                codebase="http://nepomuk.whateverdomainitis.com/public_html/" archive="blabla.jar"
                But that's just a thought, it might be quite different with your server.

                Greetings,
                Nepomuk

                Comment

                • drsmooth
                  New Member
                  • Oct 2007
                  • 112

                  #9
                  i just tried that and still got the same problem.

                  this is getting rather frustratng lol....i will be calling my web host to see if perhaps they are to blame for this but i doubt that they are...

                  Comment

                  Working...