The Java.lang. noclassdeffounder occurred in a code when the programmer write a wrong class name on the command prompt during the execution or running of the program.
In this Tutorial we want to describe you a case that helps you in understanding a java.lang.noclassdeffounder.For this we have a class name 'java langnoclassdeffounder'.Inside this main class we have a main method that include -
| Input Stream Reader | This is used to read a byte code that is used to decode byte code into a character stream |
| BufferStream Reader | This is used to read a text character stream present in a input stream reader. |
| readline | This is used to read a number printed on the command prompt. |
On command prompt if the programmer mistakenly write a wrong class name during the running of the program, the code display you an error i.e java langnoclassdeffounder.In this example the programmer write wrong a class name javanoclassdeffounderror1 instead of writing javalangnoclassdeffounderror.Therefore on execution the code show an error java.langnoclassdeffounderror.java.
javalangnoclassdefounderror.java|
import java.io.*; public class javalangnoclassdefounderror { public static void main(String args[]) throws Exception{ InputStreamReader inputStreamReader = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(inputStreamReader); System.out.println("Enter a number : "); String num= br.readLine(); System.out.println("entered nuber is: "+num); } } |
To solve this error you have to check wheather during compile time you have given java file name correct or not.
Download code
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java error java.lang.noclassdeffounderror
Post your Comment