Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling main method  RSS feed

 
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: 1836
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!