Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic


Zubair Ali

Joined: Sep 21, 2002
Posts: 2
I was trying to run a demo program viz. DemoGUI
Compilation was fine and didn't give any warning or errors
while running it gave the following error
Exception in thread "main" java.lang.NoClassDefFoundError: DemoGUI (wrong name:
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
The location of and DemoGUI.class is
the variable
package and import stmts of the DemoGUI are as
package org.freehep.j3d.plot.test;
import org.freehep.j3d.plot.*;
import javax.swing.*;
import java.awt.*;
What could be done to run this prg.
Thanks in advance
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
your source file is called, yet the class file is DemoGUI.class, is it safe to assume you renamed your source file?
whatever your answer tho have a look in those directories, and start by deleting your class file, then rebuild and make sure your class goes to the directory you specified in the package statement
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Welcome to JavaRanch, Zali. Please take a look at JavaRanch's Naming Policy and change your displayed name accordingly. Thanks

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
You should also try using the package name along with the class name. For example
java org.freehep.j3d.plot.test.DemoGUI
Also be sure to use the correct capital letters in the class name. Your problem may be as simple as that, in fact.

Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: NoClassDefFoundError
It's not a secret anymore!