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

    Default getting problem in compiling java program?

    C:\PROGRA~1\Java\JDK15~1.0\bin>javac sample.java

    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 "sathish04021984@gmail.com", plse send me gays:confused:

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

    Default

    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
    Posts
    8
    Rep Power
    0

    Default

    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 : sample.java
    yr classname shld be: sample

    i guess this wld be help....

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

    Default

    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, 04:14 PM
  2. Replies: 0
    Last Post: 04-04-2008, 02: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, 10:41 AM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  5. problem compiling servlets
    By boy22 in forum Java Servlet
    Replies: 1
    Last Post: 08-03-2007, 10: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
  •