I am trying to merge 2 simple programs I have made to one .jar. I packed both .jars into a new one and used Runtime.getRuntime().exec method to execute them.
Code:
public class main {
public static void main(String[] args) {
try {
Runtime.getRuntime().exec("cmd /c proj1.jar");
} catch(Exception exce){
/*handle exception*/
try {
Runtime.getRuntime().exec("cmd /c proj2.jar");
} catch(Exception exc){
/*handle exception*/
}
}
}
}
The problem is that only proj1.jar is executed and proj2.jar doesn't run. I am new to java and don't know why this happens. How do I fix this? I want both files to be executed.