Is there any way i can run some code after the Main.main()
method?
System.out.println("execution start");
Main.main(new String[]{"-g","","./src/main/java/featureDetails/Testing.feature"});
System.out.println("execution over");
In this case system not able to print execution over
.
If you look at the source of Main.main()
you'll notice that it contains: System.exit(exitstatus)
which terminates the system before it can return control to your method and print the message.
The proper way to run the commandline programatically would be to use:
String [] argv = new String[]{ "-g","","./src/main/java/featureDetails/Testing.feature"};
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
byte exitstatus = Main.run(argv, contextClassLoader);