[josm-dev] restart JOSM
Alexander Wright
alexander at wright-family.me.uk
Thu Dec 10 14:56:25 GMT 2009
On this note, has anyone here played Puzzle Pirates?
I mention this because the game is written in Java, and has an online update
capability.
You down load a Java loader application (small) that fetches the latest
version of the code from the server. When the upload is complete it runs the
game code, and terminates. The user runs the game code from then on.
The first thing the game does is check for the latest version. If it is not up
to date, it runs the loader application, and terminates. The loader updates
the game (via diff) and launches the game once download is complete.
Its a simple model, and one that I believe JOSM could benefit from emulating.
Just my 2p.
:-)
On Thursday 10 Dec 2009 14:43:16 Ævar Arnfjörð Bjarmason wrote:
> On Thu, Dec 10, 2009 at 14:21, Dieter Muecke <d_mueck at me.com> wrote:
> > Instead of restarting JOSM by hand after plugin update the code snippet
> > below does it programmatically. It works on Mac OSX but before I submit a
> > patch I would like know how do the same on Windows and Linux.
> >
> > Kind Regards,
> > Dieter
> >
> > try {
> > File file = File.createTempFile("josm-restart-", ".sh");
> > PrintWriter pw = new PrintWriter(new FileWriter(file));
> > pw.println("sleep 1");
> > pw.println("open -a JOSM.app");
> > pw.close();
> > Runtime.getRuntime().exec("/bin/sh " +
> > file.getAbsolutePath()); System.exit(0);
> >
> > } catch (IOException e) {
> > e.printStackTrace();
> > }
>
> Why are you writing a josm-restart.sh instead of just calling /bin/sh
> with "sleep 1 && open -a JOSM.app"?
>
> But no, this wouldn't work on Linux. open(1) is a Mac OS X-specific
> application, the usual way to do this on Linux is to look at your
> argv[0] and start that with your argv[1..*] arguments.
>
> However with Java programs that wouldn't work since you need to worry
> about calling the right JVM and using the arguments to the JVM that
> were used to start the current program.
>
> I'm not familiar enough with the JVM but doesn't it support reloading
> itself with the current environment/arguments and the currently loaded
> .jar? Then this could probably be implemented portably.
>
> There's also probably prior art on this, check out
> http://google.com/codesearch
>
> _______________________________________________
> josm-dev mailing list
> josm-dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/josm-dev
>
More information about the josm-dev
mailing list