Class inside a class problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rick

    Class inside a class problem

    Hi,

    I made a little Japplet in Netbeans. It uses a sub-class to store some
    things. Netbeans can get the stuff compiled and running but when I try it in
    Internet Explorer the Java console gives this error :
    "java.lang.NoCl assDefFoundErro r: <applet>$<sub-class>"

    I've declared the sub class as follow :
    public class TestApplet extends javax.swing.JAp plet {
    public class Number
    < stuff >
    }
    < bla bla >
    }

    I know I can put this number class into another Java file but due some
    isseus(it got to be stored on a microcontroller ) I want everything in 1
    ..class file. Why is Internet Explorer too stupid to execute the applet or
    am I doing something wrong?

    Greetings,
    Rick


  • Rick

    #2
    Re: Class inside a class problem

    Well, I 'solved' the problem a bit. I saw Netbeans generates 3 files in this
    case :
    - TestApplet.clas s
    - TestApplet$Numb er.class
    - TestApplet$1.cl ass // where the heck is this one good for?
    It works in IE now but then again, ain't there a way to stuff al these 3
    files in one?

    Greetings,
    Rick


    Comment

    • Amey Samant

      #3
      Re: Class inside a class problem

      "Rick" <aso3rick@hotma il.com> wrote in message news:<3f93b82c$ 0$58704$e4fe514 c@news.xs4all.n l>...[color=blue]
      > Well, I 'solved' the problem a bit. I saw Netbeans generates 3 files in this
      > case :
      > - TestApplet.clas s
      > - TestApplet$Numb er.class
      > - TestApplet$1.cl ass // where the heck is this one good for?
      > It works in IE now but then again, ain't there a way to stuff al these 3
      > files in one?
      >
      > Greetings,
      > Rick[/color]

      hi
      bundle them in a jar
      & use archive=myjar in APPLET tag

      regards
      amey

      Comment

      • Rick

        #4
        Re: Class inside a class problem

        Thanks for the tip! But can JAR files be executed like normal class files in
        a webpage or do I need to 'unzip' them first?

        Greetings,
        Rick


        Comment

        • Rick

          #5
          Re: Class inside a class problem

          Maybe it's just me but I can't get the jar files to work. Originally I had 1
          java file with 1 sub class. After compiling I got 3 class files. I packed
          the stuff in 1 jar file using the JDK tool and then created a new test
          folder. Inside that folder there are 2 files now,
          the jar file (test.jar)
          and a html webpage for testing
          In that testpage I now have these lines for loading the applet :

          <APPLET code="myClass.c lass" ARCHIVE="test.j ar"
          width=300 height=200></APPLET>

          When running the webpage in Internet Exploder 5.5 (win98) the applet won't
          get loaded. If I view the Java Console it seems that he just tries to find
          myClass.class. But there's nothing about test.jar so I doubt if the webpage
          even tries to use the jar file. These are the 2 errors :
          "java.lang.clas sNotFoundExcept ion: myClass.class"
          "java.io.fileNo tFoundException : ....\myClass\cl ass.class"
          As for the second error, that file indeed doesn't exists but where to change
          that path? Maybe it has something to do with the platform?

          Greetings,
          Rick


          Comment

          • Rick

            #6
            Re: Class inside a class problem

            Never mind, it was the case sensitiv shit, Java messed up filenames etc.
            etc. I hate case sensitivity but what am I gonna do about it? anyway, thanks
            for helping!

            Greetings,
            Rick


            Comment

            Working...