开发者

Launch External Jar through Java Application

开发者 https://www.devze.com 2022-12-29 21:59 出处:网络
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)

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消