5

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?

Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875

2 Answers2

3

Either use Desktop#open() or just put it in classpath and invoke its main().

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
1

You should be able to just use java to run the jar.

Runtime.getRuntime().exec("java -jar calc.jar");
Milhous
  • 14,473
  • 16
  • 63
  • 82