• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Netbeans

 
Jeff Te
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

run:
Exception in thread "main" java.lang.NoClassDefFoundError: PhraseOmatic
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)

Cans someone help me with this?

Thanks!
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

run:
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50175
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic