Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in thread "main" NoClassDefFoundError  RSS feed

 
ShaunRobert Williams
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is the package statement.

Try removing that or putting that source file in a directory that matches the package.
 
ShaunRobert Williams
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Removing the package statement didnt fix it, but moving the file to its proper directory did.

Thanks Keith!
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, sorry.

If you remove the package statement in the second, you need to remove the import statement in the first.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!