Exception in thread "main" java.lang.NoClassDefFoundError

I receive the following error trying to run the class Music5.class ( it does have a main entry, it is in the C:\java\code\c08\music5 directory)
--------------------------------------------------------------------------------------------
C:\java\code\c08\music5>java -classpath C:\java\code Music5.class
Exception in thread "main" java.lang.NoClassDefFoundError: Music5/class

C:\java\code\c08\music5>java Music5
Exception in thread "main" java.lang.NoClassDefFoundError: Music5 (wrong name: c
08/music5/Music5)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

C:\java\code\c08\music5>
-----------------------------------------------------------------------

Any thoughts?
kellyputtyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hoomanvCommented:
java -classpath C:\java\code Music5 // without .class
0
hoomanvCommented:
is Music5 in a package ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kellyputtyAuthor Commented:
Thank you.
It was:
java -classpath C:\java\code c08.music5.Music5

Even if you are in the appropriate directory you need to specify the entire package name?
0
hoomanvCommented:
yes
it is correct too, no need for classpath if you are already in C:\java\code
C:\java\code> java c08.music5.Music5

thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.