0

As, it is easy to download jars and other artifacts using http://code.google.com/p/jnlpdownloader/

So, I am trying to execute my business application from a small launcher application(this launcher application is running as Java web start application).

This launcher application,

  • first download executable business application jar from URL(available at runtime only)
  • And then execute the executable business jar.

But, the following code doesn't seems to work, nor, it is throwing any exceptions

String[] command = {"java -jar", "JarFromURL.jar"};
        Runtime r = Runtime.getRuntime();
        try {
            r.exec(command);
        } catch (IOException e1) {

            JOptionPane.showMessageDialog(null, "Voilla...") ;
        }
1
  • 1
    1) exec throws 3 other exceptions besides IOException, what are you doing with those? 2) Be sure to read & implement all the recommendation of When Runtime.exec() won't. By the looks of it, you copied that code from the back of a box of coco-pops. 3) Use ProcessBuilder in this millennium. Commented Jan 22, 2012 at 0:50

1 Answer 1

1

The array of parameters passed to exec() should be split this way.

String[] command = {"java", "-jar", "JarFromURL.jar"};
Sign up to request clarification or add additional context in comments.

1 Comment

Also consider ProcessBuilder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.