aspose 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: 1740
    
    2
MyClass.main( null ) ;
Adam Blinkinsop
Greenhorn

Joined: Mar 22, 2002
Posts: 7
'nuff said.
 
 
subject: Invoking the main() from another class
 
Similar Threads
main method invocation possible from another class?
Accessing the main method
Calling public static functions from non public classes
main method private
Nested classes - Series of doubts