aspose file tools*
The moose likes Beginning Java and the fly likes Netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Netbeans" Watch "Netbeans" New topic
Author

Netbeans

Jeff Te
Greenhorn

Joined: Aug 11, 2009
Posts: 18
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

Joined: Apr 20, 2006
Posts: 3344

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.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Netbeans