1

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.

Nana
  • 77
  • 1
  • 11

1 Answers1

1

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

bns
  • 392
  • 2
  • 9
  • Hello, After I added in the -CP tab / set CLASSPATH, it now says that it cannot load / find the main class. Do you know why this is so? – Nana May 03 '16 at 17:54
  • try to include . for the current directory and be in the directory of the main class where calling it from the CP – bns May 03 '16 at 18:06