I am getting this error
Exception in thread "main" java.lang.NoClassDefFoundError: TestApp (wrong name: Test/TestApp)
which I have googled and tried suggestions, but it doesn't fix it. I have tried unsetting my CLASSPATH etc. and it doesn't work. The file TestApp.class IS in the directory that I am running the program from.

I only get this error when I try and put my two classes in "package Test;" Otherwise it executes fine.

Thanks for the help

Recommended Answers

All 2 Replies

If you define them to be in package Test; , you'll need to run it from the directory above Test with the command java Test.TestApp

Yay thanks! I didn't understand thats where I was supposed to run it from I guess.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.