-
Unable to run Java Program
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?
-
Re: Unable to run Java Program
"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.
-
Re: Unable to run Java Program
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?
>
-
Re: Unable to run Java Program
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?
>>
>
>
-
Re: Unable to run Java Program
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
-
Re: Unable to run Java Program
"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
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks