Results 1 to 3 of 3
  1. #1
    kranthivee is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Thumbs up Exception in thread "main" java.lang.NoClassDefFoundError

    Exception in thread "main" java.lang.NoClassDefFoundError: First
    caused by: java.lang.ClassNotFoundException: First
    at java.net.URLClassLoader$1.run<Unknown Source>
    at java.security.AccessContoller.doPrevileged<Native Method>
    at java.net.URLClassLoader.findClass<Unknown Source>
    at java.lang.ClassLoader.loadClass<Unknown Source>
    at sum.misc.Launcher$AppClassLoader.loadClass<Unknown Source>
    at java.lang.ClassLoader.loadClass<Unknown Source>
    could not find the main class: First. program will exit.

    this is the error showing when I am executing the program name as First
    and I set

    PATH
    C:\Program Files\Java\jdk1.6.0_24\bin;.;

    classpath
    C:\Program Files\Java\jdk1.6.0_24\lib


    but it is unable find the class file?? what is the problem??
    Anybody please help me?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,371
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by kranthivee View Post
    Exception in thread "main" java.lang.NoClassDefFoundError: First
    caused by: java.lang.ClassNotFoundException: First
    at java.net.URLClassLoader$1.run<Unknown Source>
    at java.security.AccessContoller.doPrevileged<Native Method>
    at java.net.URLClassLoader.findClass<Unknown Source>
    at java.lang.ClassLoader.loadClass<Unknown Source>
    at sum.misc.Launcher$AppClassLoader.loadClass<Unknown Source>
    at java.lang.ClassLoader.loadClass<Unknown Source>
    could not find the main class: First. program will exit.

    this is the error showing when I am executing the program name as First
    and I set

    PATH
    C:\Program Files\Java\jdk1.6.0_24\bin;.;

    classpath
    C:\Program Files\Java\jdk1.6.0_24\lib


    but it is unable find the class file?? what is the problem??
    Anybody please help me?
    Remove that classpath variable, it isn't needed to make it point to the lib directory. Make sure you have compiled your Free.java class (check if there is a Free.class file generated) and run it like:

    Java Code:
    java -cp . Free
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    goldest's Avatar
    goldest is offline Senior Member
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    469
    Rep Power
    5

    Wink

    Use -cp or -classpath and provide the path where your class file is supposed to be.

    For more details, refer here: java application launcher.

    Goldest
    Java Is A Funny Language... Really!
    Click on * and add to member reputation, if you find their advices/solutions effective.

Similar Threads

  1. Replies: 5
    Last Post: 06-02-2010, 01:05 PM
  2. Replies: 3
    Last Post: 06-01-2010, 03:01 PM
  3. Replies: 1
    Last Post: 04-02-2009, 09:50 PM
  4. Replies: 6
    Last Post: 08-18-2008, 06:44 AM
  5. Replies: 2
    Last Post: 08-01-2007, 05:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •