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 How to Call main() method another class from one class. 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 "How to Call main() method another class from one class." Watch "How to Call main() method another class from one class." New topic
Author

How to Call main() method another class from one class.

Amol Pingate
Greenhorn

Joined: Oct 02, 2008
Posts: 14
can any one tell me how to call main() of One class from another class
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

AnotherClass.main() assuming main() is public static. This post needs to be in Java in General (Beginner)


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

Moving to the beginner forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18103
    
  39

And assuming this main() method is the method that can be called from the command line, you also need to create a string array, as that methods takes a string array -- and fill in the params of course.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Call main() method another class from one class.
 
Similar Threads
How to call another class when there is no source code?
How to call one class main method from another class main method
main()
Overloading wih static methods
invoking classes