Unable to run Java Program


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Unable to run Java Program

  1. #1
    Suresh.M Guest

    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?


  2. #2
    Simon Sellick Guest

    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.

  3. #3
    David Stevenson Guest

    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?
    >




  4. #4
    algruber Guest

    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?
    >>

    >
    >



  5. #5
    w Guest

    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


  6. #6
    ronald Guest

    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center