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 Invoking the main() from another class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Invoking the main() from another class" Watch "Invoking the main() from another class" New topic
Author

Invoking the main() from another class

David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
Is there a cleaner way to invoke the main method of a class from within another class other than below?
String[] fakeCommandLineArgs = {};
MyClass.main(fakeCommandLineArgs);
I don't intend on passing arguments to the main so I'd like to avoid creating an empty String array if possible.
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
MyClass.main( null ) ;
Adam Blinkinsop
Greenhorn

Joined: Mar 22, 2002
Posts: 7
'nuff said.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invoking the main() from another class