Search code examples
javaeclipsenoclassdeffounderror

Exception in thread "main" java.lang.NoClassDefFoundError: com/csvreader/CsvWriter


I have a java project written with eclipse and when I tried to run a class file using windows command prompt, I had the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/csvreader/CsvWriter

The code is running well on eclipse but not on command prompt. Do anyone know why? Thanks in advance!

I have checked that the builtime classpath and the runtime classpath is the same.


Solution

  • It seems like your problem is related to the classpath. Your eclipse is including the correct classpath, but you are not including it in the command prompt.

    You can read about it in the following links: https://en.wikipedia.org/wiki/Classpath_(Java) https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html