wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" NoClassDefFoundError" Watch "Exception in thread "main" NoClassDefFoundError" New topic
Author

Exception in thread "main" NoClassDefFoundError

ShaunRobert Williams
Greenhorn

Joined: Apr 19, 2007
Posts: 3
Hi, im trying to comple this code on a Mac running OS X 10.4.





Both files are in the same dir. I do a javac *.java
and then java -classpath . MainFrame

I Get: Exception in thread "main" java.lang.NoClassDefFoundError: MacGUI/MacJMenuBar

Any ideas?
Thanks a bunch.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
The problem is the package statement.

Try removing that or putting that source file in a directory that matches the package.
ShaunRobert Williams
Greenhorn

Joined: Apr 19, 2007
Posts: 3
Removing the package statement didnt fix it, but moving the file to its proper directory did.

Thanks Keith!
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Oops, sorry.

If you remove the package statement in the second, you need to remove the import statement in the first.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" NoClassDefFoundError
 
Similar Threads
Updating JMenuBar
Enabling a disabled Menu Item
Resize problem with JMenuBar
JMenu Construction problem
OO Question