wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes This code tells me i don't have a main() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "This code tells me i don Watch "This code tells me i don New topic
Author

This code tells me i don't have a main()

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266



java.lang.NoSuchMethodError: main
Exception in thread "main"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

The public class doesn't have a main method, so why is this a surprise?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pramod P Deore
Ranch Hand

Joined: Jul 15, 2008
Posts: 629

You must have to write main method in public class and save file name as name of public class.


Life is easy because we write the source code.....
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3816

Or you should run the Test5 not the Test4 class.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Thangaraj Selvamani
Ranch Hand

Joined: Sep 20, 2008
Posts: 61
Make Test5 class as public and remove public from Test4 class. save the filename in Test5.java
Lalit Mehra
Ranch Hand

Joined: Jun 08, 2010
Posts: 384

the filename corresponds to the name of the public class in the java file ... and only one class can be public ...


http://plainoldjavaobject.blogspot.in
 
 
subject: This code tells me i don't have a main()
 
Similar Threads
Protected access
Inner classes referencing outer class name?
Que on JohnHunt exam
Intializers
whats the differenc