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

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calling main method" Watch "Calling main method" New topic

Calling main method

jamie ong

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
Shiva Kumar
Ranch Hand

Joined: Feb 09, 2001
Posts: 30
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
Michael Matola
Ranch Hand

Joined: Mar 25, 2001
Posts: 1764
It is sorta covered in the JavaRanch Style Guide.
subject: Calling main method