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
  • 48,324
  • 124
  • 436
  • 828

2 Answers2

3

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

BalusC
  • 1,040,783
  • 362
  • 3,548
  • 3,513
1

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

Runtime.getRuntime().exec("java -jar calc.jar");
Milhous
  • 14,261
  • 16
  • 61
  • 80