GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Weird errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Weird errors" Watch "Weird errors" New topic
Author

Weird errors

Caleb Alien
Greenhorn

Joined: Sep 02, 2012
Posts: 4
So I'm not exactly "new" to java or the programming scene but I've never seen this error before. I'm new to eclipse so maybe that's it.
Here's my code

When I run as java application I get ," Selection does not contain a main type".

Any help?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

So I'm not exactly "new" to java or the programming scene

Maybe you're trying to execute this class which does not have a main method ?


[My Blog]
All roads lead to JavaRanch
Caleb Alien
Greenhorn

Joined: Sep 02, 2012
Posts: 4
How would I check this?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16


Your class is called Main. There's a constructor-like method called RandomNumberGame but it does not fit the class name. Unless you wanted to call the method "randomNumberGame" ? It looks like you're confusing the concept of having a main method and naming a class "Main". Naming a class "Main" is not going to make it the entry point of your program.

Read more about the main method here.
Caleb Alien
Greenhorn

Joined: Sep 02, 2012
Posts: 4
Thanks, that fixed it ( making a new class that wasn't stupid ).

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39044
    
  23
…and welcome to the Ranch
Caleb Alien
Greenhorn

Joined: Sep 02, 2012
Posts: 4
Thanks man
 
GeeCON Prague 2014
 
subject: Weird errors