Results 1 to 6 of 6

Thread: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

  1. #1
    Join Date
    May 2008
    Posts
    347

    Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    I do not know Java at all, now go back to modify the files to compile errors need to happen.

    Is of the current environment.
    > C: \ j2sdk1.4.1_01 installation

    > The file path
    c: \ Dbsync

    ==> Trying to do the test to compile, but java without the errors.

    => Exception in thread "main" java.lang.NoclassDefFoundError: ReImportDb
    Search over the place ... I got back to class, do the pass is still the same symptoms .. ㅠ ㅠ

    What's wrong with me?
    Class Pass used to say to you I'm being held.

    Please help me.

  2. #2
    Join Date
    May 2008
    Posts
    353

    Re: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    Caused by the difference in the case seem ...

    ReImportDB of the 'I' is (in the file name or class name) is upper-or lowercase.

    Check out something like good-spirited.

  3. #3
    Join Date
    May 2008
    Posts
    90

    Re: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    Hi,

    Sometimes, by mistake, we try to execute a Java program without compiling it successfully. If a Java class is not compiled successfully, no class file (a file with extension class) is generated. So we need to compile the Java program at first, then it should be run.

    If a class file does not exist or the class is in such a package which is not in the CLASSPATH but you are trying to run that class, then you may see "Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]".

    The class might be in another directory or package. The class must be in the CLASSPATH for the successful running.

    In another situation along with the above error message you may see "CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory" and "CMD does not support UNC paths as current directories". You may see this when you run a program by a batch file or by using TextPad etc. This error means you are running a class which is located in a remote machine and you have given the address of the class like \\RemotePC\directory\ClassName. You should bring the class to your PC (if required) to run it. Or if you want to call a class from the remote PC you may use RMI.

  4. #4
    Join Date
    Mar 2008
    Posts
    672

    Re: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    The Java Virtual Machine refers to the CLASSPATH environment variable to locate Java classes. Some programs modify the CLASSPATH in a way that causes the Java command-line tools to fail with the error message

    Code:
     Exception in thread "main" java.lang.NoClassDefFoundError: className
    where className is the name of the Java program (e.g., Welcome1). To correct this problem, use the -classpath command-line argument when compiling and running your programs. For example, to compile Welcome1.java, type

    Code:
      javac -classpath . Welcome1.java
    To execute the program, type

    Code:
    java -classpath . Welcome1
    The "." tells the compiler and virtual machine to look in the current directory for classes. Alternatively, you can permanently remove the CLASSPATH environment variable on Windows 2000 and Windows XP by going into the System control panel, selecting the Advanced tab, clicking the Environment Variables button and removing the CLASSPATH entry from the User variables and System variables boxes.

  5. #5
    Join Date
    Oct 2010
    Posts
    1

    Re: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    Quote Originally Posted by Allan.d View Post
    The Java Virtual Machine refers to the CLASSPATH environment variable to locate Java classes. Some programs modify the CLASSPATH in a way that causes the Java command-line tools to fail with the error message

    Code:
     Exception in thread "main" java.lang.NoClassDefFoundError: className
    where className is the name of the Java program (e.g., Welcome1). To correct this problem, use the -classpath command-line argument when compiling and running your programs. For example, to compile Welcome1.java, type

    Code:
      javac -classpath . Welcome1.java
    To execute the program, type

    Code:
    java -classpath . Welcome1
    The "." tells the compiler and virtual machine to look in the current directory for classes. Alternatively, you can permanently remove the CLASSPATH environment variable on Windows 2000 and Windows XP by going into the System control panel, selecting the Advanced tab, clicking the Environment Variables button and removing the CLASSPATH entry from the User variables and System variables boxes.

    //Thanks for your post but it still isn't working plz do help it's getting on my nerves if u have a real ggo solution plz do mail it to jwaleetpainter@yahoo.com(plz do send it as soon as possible)

  6. #6
    Join Date
    Dec 2007
    Posts
    2,291

    Re: Exception in thread "main" java.lang.NoClassDefFoundError: [ClassName]

    Quote Originally Posted by Java_freak007 View Post
    //Thanks for your post but it still isn't working plz do help it's getting on my nerves if u have a real ggo solution plz do mail it to jwaleetpainter@yahoo.com(plz do send it as soon as possible)
    Java of course is case-sensitive, so the class name must be exactly as declared in the class file, and the same as the file name. As the exception suggests - you have a problem with names. Try renaming the helloworldapp.java file to HelloWorldApp.java and running "java HelloWorldApp" .

Similar Threads

  1. Replies: 3
    Last Post: 19-02-2011, 03:20 AM
  2. Replies: 4
    Last Post: 08-04-2010, 12:37 PM
  3. Error message: Uncaught Exception java.lang.error
    By Rum in forum Portable Devices
    Replies: 5
    Last Post: 06-01-2010, 01:59 PM
  4. java.lang.NoClassDefFoundError: Classname
    By Learningj in forum Software Development
    Replies: 3
    Last Post: 09-11-2009, 08:59 AM
  5. Java.lang.OutofMemory.Exception error
    By Unnat in forum Software Development
    Replies: 3
    Last Post: 07-05-2009, 11:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,674,957,969.39027 seconds with 17 queries