Monday, January 21, 2013

Java - Error Encountered - Caused by: java.lang.ClassNotFoundException

JDK: External version 6, Internal version 1.6.0 update 25


Executing class file

Command:
java QuotationTest.java

Exception in thread "main" java.lang.NoClassDefFoundError: QuotationTest/java
Caused by: java.lang.ClassNotFoundException: QuotationTest.java
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: QuotationTest.java.  Program will exit.

Resolution:

Run using below command:
java QuotationTest



No comments:

Post a Comment