I'm running a java program from command prompt, it has passed compilation and when i run i found this exceptions : C:\Java-source>java Template.java Exception in thread "main" java.lang.NoClassDefFoundError: Template/java I have the main.class in the directory, so how come it throws java.lang.NoClassDefFoundError? Please give me any feedbacks However, this is my source code
Originally posted by Jesper Young: If your class is called "Main", it should be in a source file called "Main.java".
This is not a restriction as the class "Main" in your code is NOT a public class. Had it been a public class, it would have been compulsory to do so. However, I also prefer that you should name your file "Main.java", but, it isn't necessary (unless you declare it public.)