File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 60046
    
  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: 3775

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: 383

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: This code tells me i don't have a main()
 
Similar Threads
Intializers
Protected access
Que on JohnHunt exam
Inner classes referencing outer class name?
whats the differenc