I am having the java main application which needs to execute another jar file and return it without waiting for the jar execution complete. Is it possible to achieve it using Java. Can anyone give some inputs in it.
            Asked
            
        
        
            Active
            
        
            Viewed 136 times
        
    0
            
            
        - 
                    1https://stackoverflow.com/questions/1320476/execute-another-jar-in-a-java-program – ArpitA Nov 27 '17 at 10:27
1 Answers
1
            Do following:
Runtime.getRuntime().exec("java -jar <PATH_OF _JAR>");
in your Main class.
And as @Yoav has suggested. You need to take care of errors by adopting proper error handling strategy.
Do Read - https://www.tutorialspoint.com/java/lang/runtime_exec.htm
 
    
    
        Pramod S. Nikam
        
- 4,271
- 4
- 38
- 62
- 
                    note that several types of exceptions might be thrown if the command was unsuccessful or not found - https://www.tutorialspoint.com/java/lang/runtime_exec.htm – Yoav Feuerstein Nov 27 '17 at 10:30
- 
                    
- 
                    Runtime.getRuntime().exec("java -jar"); return. Will it trigger the jar and return my main function immediately? – Soorya Prakash Nov 27 '17 at 10:33
- 
                    
