Please Help to rectify
I just tried to run my first java program in command prompt.
It gives the following error. Please help me to rectify.
Exception in thread "main" java.lang.NoClassDefFoundError: Welcome
Caused by: java.lang.ClassNotFoundException: Welcome
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
Thank you in advance
It can't find a Welcome class file in the D:\java directory.
Unless the OP has changed the name of the class file then that won't have happened. If the java file name was different then there'd be a compiler error.
Originally Posted by akiravelmont
So posting the code will not help.
A directory listing might.
if we wont give public before the class it never give any compilation error.
but shows exceptions.
But in the exception it mention wrong class. I forgot that one. sorry
Thank you very much for replying.
After trying everything to rectify the code and command lines I did a virus scan.
Found several files in java\bin directory infected.
After disinfecting it the program works.
What had happen was it doesn't allow to create a class file, even javac command is given correctly.
Thank you again