Jeff Te wrote:Hello...I am using Netbeans along with Head First Java. When I open up any project and copy and paste the code I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: PhraseOmatic
Ideally, the 'NoClassDefFoundError' should come when you run your java class and NOT just after copy, paste the code.
It would be due to the fact that the IDE is NOT able to pick up the .class file of the class you are attempting to. Does the source file have any package statement? If so you should create a folder structure matching to that of package hierarchy and then try running it.
Jeff Te wrote:Hello...I am using Netbeans along with Head First Java. . . .
It's not usually a good idea to use an IDE (eg NetBeans) until you are a lot more experienced. Can't tell why you are getting that error without more details, but if you write the classes for yourself and put them into a folder structure, you can see what is happening. And make sure to take Raghavan Muthu's hint and leave out the package names at this stage.