Issue
I look for a good manner to automate my project. I have a project with many steps. In every steps output files are generated and compared with other files. Until know I wrote for each step a mainfunction that I have to let run in a certain order, because first I just needed the intermediate result. I know my project structure is not well planned. Is there a smart way to write a function, that run all the main-functions of the project in the correct order? Something like a Makefile
in intelliJ?
My code works correctly but it is very bad structured and for a strange person not handy. I want to make it more handy without changing my code to much.
Solution
There's no need to create some ant/maven build configuration. main
is a static method just like any other. So you can simply create a class which would call the main methods of other classes
public class YourSuperClass{
public static void main(String[] args) {
YourClass1.main(null); //You can provide String[] args instead of null
YourClass2.main(null);
YourClass3.main(null);
}
}
Answered By - NeplatnyUdaj
Answer Checked By - Gilberto Lyons (JavaFixing Admin)