Launch External Jar through Java Application
Currently, I have an Java Standalone Swing Application.
Now, when user clicks on the button in the Swing Application, I would like to launch another Java Application (Say : calculator.jar)
May I know what is the portable way to do so? So that it will work 开发者_开发问答in multiple OS?
Either use Desktop#open()
or just put it in classpath and invoke its main()
.
You should be able to just use java to run the jar.
Runtime.getRuntime().exec("java -jar calc.jar");
精彩评论