After compilation when i try to run a Java program it is giving the following
the error message.
Exception in thread "main" java.lang.NoClassDefFoundError: Class file name.
Can u help me?
Printable View
After compilation when i try to run a Java program it is giving the following
the error message.
Exception in thread "main" java.lang.NoClassDefFoundError: Class file name.
Can u help me?
"Suresh.M" <sureshm@eudoramail.com> wrote:
>
>
>After compilation when i try to run a Java program it is giving the following
>the error message.
>
>Exception in thread "main" java.lang.NoClassDefFoundError: Class file name.
>
>Can u help me?
>
Suresh,
What platform are you running it on?
You could look at these:
- Check your main() method is correctly defined (public void)
- Make sure it compiles without warnings!
- Check your CLASSPATH environment variable
- Make sure the .class files for any classes used exist...
- ...and are in the expected place in the directory tree.
Simon.
The JDK 1.3 documentation says:
public class NoClassDefFoundError
extends LinkageError
Thrown if the Java Virtual Machine or a classloader tries to load in the
definition of a class (as part of a normal method call or as part of
creating a new instance using the new expression) and no definition of the
class could be found.
The searched-for class definition existed when the currently executing class
was compiled, but the definition can no longer be found.
=============================================================
Did you delete any of the .class files?
You may want to put in System.out.println ( "checkpoint #1" ) ; statements
to try to locate which class is not found. Is it possible
"Suresh.M" <sureshm@eudoramail.com> wrote in message
news:3a1c0061@news.devx.com...
>
>
> After compilation when i try to run a Java program it is giving the
following
> the error message.
>
> Exception in thread "main" java.lang.NoClassDefFoundError: Class file
name.
>
> Can u help me?
>
In the IDE I use (RealJ), I get that message if I compile my program as an
applet and then try to run it as an application.
"David Stevenson" <drs2@frontiernet.net> wrote:
> The JDK 1.3 documentation says:
>
> public class NoClassDefFoundError
> extends LinkageError
>Thrown if the Java Virtual Machine or a classloader tries to load in the
>definition of a class (as part of a normal method call or as part of
>creating a new instance using the new expression) and no definition of the
>class could be found.
>
>The searched-for class definition existed when the currently executing class
>was compiled, but the definition can no longer be found.
>
>=============================================================
>
>Did you delete any of the .class files?
>
>You may want to put in System.out.println ( "checkpoint #1" ) ; statements
>to try to locate which class is not found. Is it possible
>
>"Suresh.M" <sureshm@eudoramail.com> wrote in message
>news:3a1c0061@news.devx.com...
>>
>>
>> After compilation when i try to run a Java program it is giving the
>following
>> the error message.
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError: Class file
>name.
>>
>> Can u help me?
>>
>
>
friend just look for your classpath. If you are using JDK 1.2 or higher make
sure your classpath points to proper jar files rather pointing to directories
or folers where jar files resides. for example: you can set your classpath
to c:\jdk1.2(jdk folder)\lib(library folder)\tools.jar;c:\jdk1.2(jdk folder)\lib(library
folder)\rt.jar and some more files.
Check your packages also that you have imported in your program. If you
are using javax.* (I mean any package or class under that package) then make
sure you have it and is in your classpath
"w" <wonderful_me_us@yahoo.com> wrote:
>
>friend just look for your classpath. If you are using JDK 1.2 or higher
make
>sure your classpath points to proper jar files rather pointing to directories
>or folers where jar files resides. for example: you can set your classpath
>to c:\jdk1.2(jdk folder)\lib(library folder)\tools.jar;c:\jdk1.2(jdk folder)\lib(library
>folder)\rt.jar and some more files.
> Check your packages also that you have imported in your program. If
you
>are using javax.* (I mean any package or class under that package) then
make
>sure you have it and is in your classpath
>