aspose file tools*
The moose likes Beginning Java and the fly likes Calling main method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calling main method" Watch "Calling main method" New topic
Author

Calling main method

jamie ong
Greenhorn

Joined: Nov 05, 2001
Posts: 24
how can i start a class from another class?
which means, i want my first class to trigger the main method inside my second class.
Any advice will be appreciated
Regards
Shiva Kumar
Ranch Hand

Joined: Feb 09, 2001
Posts: 30
Hi,
Calling main method of another from a class is possible only through invoking another JVM.
Runtime r = Runtime.getRuntime();
Process p = r.exec("java classname arg");
classname = Your Classname
arg = Argument for your classname if any
Shiva.
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling main method