If I understand your question properly, you want to launch another program from your program.
If possible, you should call the main
function of the second program from the first.
Otherwise, try Runtime.exec()
or ClassLoader
. Note that I've never used ClassLoader
, so I might be interpreting the docs wrong, but it seems to be something that might accomplish you're looking for. Googling tells me that it's probably excessive to use it for a program such as yours, though, so I'd stick with Runtime.exec()
.
Edit: Runtime.getRuntime().exec("cmd /c java -jar fileTwo.jar")
, assuming your jar is named fileTwo
. Make sure your jar is executable.