• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling main method

 
jamie ong
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1817
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic