Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Rep Power

    Default getting problem in compiling java program?


    C:\PROGRA~1\Java\JDK15~1.0\bin>java sample
    Exception in thread "main" java.lang.NoClassDefFoundError: sample

    hi gays, can anyone help me? i do't know i am getting this problem while compiling the java programs, please anyone send me solutions to my id,
    my id is "", plse send me gays:confused:

  2. #2
    valery is offline Member
    Join Date
    Jul 2007
    Rep Power


    java cannot find your bytecode file, sample.class

    One of the places java tries to find your .class file is your current directory. So if your .class file is in C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:

    cd c:\java

    The prompt should change to C:\java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java HelloWorldApp again.

    If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try clobbering the classpath with the following command.

    set CLASSPATH=

    Now enter java sample again. If the program works now, you'll have to change your CLASSPATH variable. To set this variable, consult the Update the PATH variable section in the JDK 6 installation instructions. The CLASSPATH variable is set in the same manner.

  3. #3
    mirage_87 is offline Member
    Join Date
    Jul 2007
    Rep Power


    he is right ....but i guess other error u might have done cld be that yr class name isin't the same as the filename.
    i mean if yr main class(the one havin the main() function ) has a different name than the one u gave to yr file it wld show similar error...
    so if yr filename is :
    yr classname shld be: sample

    i guess this wld be help....

  4. #4
    Swamipsn is offline Member
    Join Date
    Jul 2007
    Rep Power


    For avoid this kind of problem please set up a class path in environmental variable list

Similar Threads

  1. a problem about java mail client program
    By lunarstyle in forum AWT / Swing
    Replies: 9
    Last Post: 12-19-2009, 05:14 PM
  2. Replies: 0
    Last Post: 04-04-2008, 03:40 PM
  3. Poblem in Compiling a c++ file from a java program...
    By Amit Kr. Mishra in forum New To Java
    Replies: 0
    Last Post: 11-06-2007, 11:41 AM
  4. Replies: 0
    Last Post: 10-04-2007, 10:33 PM
  5. problem compiling servlets
    By boy22 in forum Java Servlet
    Replies: 1
    Last Post: 08-03-2007, 11:05 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