11

Run a pot from another pot

 4 years ago
source link: https://www.codesd.com/item/run-a-pot-from-another-pot.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Run a pot from another pot

advertisements

Re-writing this for clarity before I bounty it:

What I want to do is make a bootstrap loader for a program that is already made in (executable)jar form. This bootstrap program would have three simple goals during it's runtime:

  1. Compare a local xml file for the target program to one that's hosted on a server (to make sure that they are the same version)

  2. If they are not the same version, and the online version is newer, download the newer version.

  3. Re-write the xml file to reflect this change.

  4. Execute the second jar file (launch it as though you launched the executable).

The issue I'm having is with step number 4. I have found myself struggling to find a solid way to launch a jar from within my bootstrap program despite looking at UrlClassLoader and other libraries.

Due to some outside issues, JNLP / Web-start is not an option for this case.

TL;DR: I need to find a way to download / launch a jar from within a jar in order to update a program at the time the bootstrap is run.

Thanks!


Runtime.getRuntime().exec()

There are some pitfalls here though if your MyApp.jar will have any output.

Check the docs for details of how to properly use exec...

http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html

And see this SO post about some of the pitfalls...

Java Runtime.exec()


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK