java.lang.NoClassDefFoundError

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtremebass
    New Member
    • Nov 2008
    • 38

    java.lang.NoClassDefFoundError

    Hi Bytes,

    i run the sample java code(BarChartDe mo.java)which is producing the Bar charts as output if no error in the program, but i got run time error like this,

    java.lang.NoCla ssDefFoundError : BarChartDemo (wrong name: org/jfree/chart/demo/BarChartDemo)
    at java.lang.Class Loader.defineCl ass1(Native Method)
    at java.lang.Class Loader.defineCl ass(Unknown Source)
    at java.security.S ecureClassLoade r.defineClass(U nknown Source)
    at sun.plugin2.app let.Applet2Clas sLoader.findCla ss(Unknown Source)
    at java.lang.Class Loader.loadClas s(Unknown Source)
    at java.lang.Class Loader.loadClas s(Unknown Source)
    at sun.plugin2.app let.Plugin2Clas sLoader.loadCod e(Unknown Source)
    at sun.plugin2.app let.Plugin2Mana ger.createApple t(Unknown Source)
    at sun.plugin2.app let.Plugin2Mana ger$AppletExecu tionRunnable.ru n(Unknown Source)
    at java.lang.Threa d.run(Unknown Source)
    Exception: java.lang.NoCla ssDefFoundError : BarChartDemo (wrong name: org/jfree/chart/demo/BarChartDemo)

    Please suggest me something about this problem.
    Last edited by xtremebass; Apr 17 '09, 06:20 AM. Reason: spell Mistakes to be corrected
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    In what package is that class(what package declaration does it have?). It's package must also match the folder structure in which you have put it.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by xtremebass
      i run the sample java code(BarChartDe mo.java)which is producing the Bar charts as output if no error in the program, but i got run time error like this,

      java.lang.NoCla ssDefFoundError : BarChartDemo (wrong name: org/jfree/chart/demo/BarChartDemo)
      Carefully check the name of your class and the name of the file in which it is stored. Also check if the path to that file matches the package structure.

      The error message says it all: the name of the class and the file don't match; the classloader did find something but the names don't match.

      kind regards,

      Jos

      Comment

      • devgupta01
        New Member
        • Jan 2008
        • 20

        #4
        if you cange the file name as class name then it will run..

        Comment

        • pjerald
          New Member
          • Oct 2007
          • 77

          #5
          check the CLASSPATH variable. you can find it easily by ,


          use this for windows -
          echo %CLASSPATH%
          use this for linux -
          echo $CLASSPATH

          Comment

          Working...