Monday, May 24, 2010

Java : NoClassDefFoundError. Simple question?

E:\%26gt;c:\j2sdk1.4.2_08\bin\java -classpath e:\FileUtil.jar test xml.txt


Exception in thread "main" java.lang.NoClassDefFoundError: test





This is my directory structure


e:\FileUtil.jar


e:\test.class


e:\xml.txt





What could be wrong? Teach me and I will grade you.

Java : NoClassDefFoundError. Simple question?
Well, what does FileUtil.jar contain? You can find out with the command:





jar tvf FileUtil.jar





But the real issue is that your classpath does not contain the directory where the test.class is. Try:





java -classpath .;e:\FileUtil.jar test xml.txt





(I only included e:\FileUtil.jar because you had it...if test.class does not depend on it, then omit it).
Reply:Hi 1st of all ur question is not clear, u didn't mentioned what are the classes present in the FileUtil.jar, also for which Class the Error is coming.


No comments:

Post a Comment