user2713086 user2713086 - 8 months ago 30
Java Question

Java class will not run (command prompt)

I have been fighting with this program for a little while now and cannot figure out what is wrong. Any help would be greatly appreciated.

So here's the issue. I have three classes one is for logging onto a mysql database, the other is to output data from the database, and the last one holds method main. I was having a huge issue with getting them to compile getting errors about not finding a symbol for a method in a different class. I finally got them to all compile by using command

"javac -d bin/cdtPack src/ src/ src/"

But, now when I try to run the class with method main I get error:

Exception in thread "main" java.lang.noClassDefFoundError: CDT (wrong
name: cdtPack/CDT)

then a list of at java....

Anyone have an idea what could be going wrong?


It looks like CDT should either belong in the package cdtPack or you are running it from the wrong directory...

Try changing into the bin directory and run the class file again. Don't forget to include the package name before the class name. For example:

...\bin> java cdtPack.CDT