How to call main() from a class (not containing the main function) in a java program?
Just like any other method (static) call you can call main method... I am sending a small code example which may be helpful PS : NOT COMPILED AND NOT TESTED... for example... class ClassContainingMainMethod { public static void main(String ax[]) { // your code ... } } class YourClass { public void yourMethod() { // your code ... String[] ax = new String[1]; ClassContainingMainMethod.main(ax); } }