Re: Best Way For a Program to Restart Itself?
From: Amey Samant (ameyas7_at_yahoo.com)
Date: 06/28/04
- Previous message: M.E.: "Java webapp to do instant messaging"
- In reply to: Hal Vaughan: "Best Way For a Program to Restart Itself?"
- Next in thread: John Harlow: "Re: Best Way For a Program to Restart Itself?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Jun 2004 23:07:16 -0700
hi Hal,
im not an expert in java
but if nothing works you can go native way
in c,c++ u can call exec sys call which overloads the given program
over itself without forking so ur parent wll now be ur newly updated
java prog
but in java i think exec will fork first n then load the program in
child (which u dun wan here)
rgrds
amey
Hal Vaughan <hal@thresholddigital.com> wrote in message news:<reSdnRL25OHZEUHdRVn-jg@comcast.com>...
> My program can, when directed, check a floppy for updates, verify the MD5
> sums from another source, then copy the new Java classes to its own
> directory tree. Once it does this, I'd like to restart the program so the
> changes take effect.
>
> What's the best way to do this?
>
> I figure if I call the program's main class, it will run, but then I'll have
> 2 instances (the original and the one that's upgraded) running -- plus I'm
> not sure if the new class I call will re-load the updated classes from
> disk, since it's still run by the same JVM.
>
> I know I can call a program through Runtime, but can I call a program from
> Runtime, as if from the command line, and exit the first program, and have
> the 2nd continue running?
>
> Thanks!
>
> Hal
- Previous message: M.E.: "Java webapp to do instant messaging"
- In reply to: Hal Vaughan: "Best Way For a Program to Restart Itself?"
- Next in thread: John Harlow: "Re: Best Way For a Program to Restart Itself?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|