jQuery in Action, 3rd edition
The moose likes IDEs, Version Control and other tools and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main" Watch "Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main" New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main

Radek Ischyrion
Greenhorn

Joined: Oct 21, 2010
Posts: 7
Hi there,

I have copied an pasted a code from an online turorial however it is generating errors on my end. The below is the code I copied and pasted from a web tutorial (so assume it's good). The code is however generating an error in my neatbeans. I excpet this to be fairly easy problem but still this is annoying. I would appreciate some info why this is ocurring


ERROR


thanks and regards, Radek
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3991
    
  18

Your class is named Tut1, and NetBeans is looking for a class named Main. Either rename your class to Main, or go to your project configuration and change the main class to Tut1.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Radek Ischyrion
Greenhorn

Joined: Oct 21, 2010
Posts: 7
Stephan,
Appreciate your response, however renaming the .java file didn't help. So didn't help renaming the class...

I have created a bit of code in Eclipse (below). The code is in randomArray.java file and compiles fine.




Now when I created the same file in NetBeans named randomArray.java and copied&pasted the code there, it's giving me the same error message.
NetBeans output:


I find this very confusing and would appreciate if you would be able to shed some light on this.

thanks and regards, Radek
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 20057
    
  44

Radek Ischyrion wrote:
I find this very confusing and would appreciate if you would be able to shed some light on this.


As already mentioned, NetBeans is looking to run a class named Main -- and not a class named Tut1 or RandomArray. I don't use netbeans so can't tell you where you went wrong.

Regardless, this looks like a NetBeans tools issue -- so moving to a more appropriate forum.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
Have you checked out Aspose?
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError: kolos/Main
 
It's not a secret anymore!