Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java self restart

 
Glen Divers
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I'm working on a self-updating application that checks for updates at app startup. I've got the version checking and download of new .jars from the server working. How do I tell my app to restart itself?

Regards
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gilbert Ostlethwaite wrote:Hi

I'm working on a self-updating application that checks for updates at app startup. I've got the version checking and download of new .jars from the server working. How do I tell my app to restart itself?

Regards


No need to re-invent the wheel - WebStart.
 
Glen Divers
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should've added that Web-Start is not an option at the moment (mainly for boring, irrelevant, political reasons).

Regards
 
James Sabre
Ranch Hand
Posts: 781
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you are re-inventing WebStart! I have great difficulty in believing that your home-grown probably buggy WebStart is more acceptable than the Sun/Oracle WebStart. In your position, I would go back to whoever has made the decision not to use WebStart and tell them that the decision makes no sense.

P.S. Use a boot-strapping application that downloads the upgrade if it exists prior to running the main application.
 
Glen Divers
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I cannot find anything in your argument to disagree with, sometimes the real world can prove to be capricious. In this particular instance, the client, who are paying, have stipulated no Web-Start. The ability to remonstrate lies several pay grades upward - and, regrettably, that puts me in the hands of "Sales".

Regards
 
alex delaguardia
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if this helps:
1- Run you application using a command file.

Inside your command file put something like this.

:restart
JRE\jre1.6.0_07\bin\java -cp .;.\program_name.jar
if exist fileName GOTO restart

before you exit you program for restarting write a file ("fileName") to the system.

Basically as long as the fileName exits the program will restart again. (you will need to remove the file after the application start).
 
Paul Clapham
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah well... let's take the passive-aggressive method then. Just call System.exit(0) after the application has been running for a minute; and have a script which calls the application again as soon as it terminates.
 
Paul Clapham
Sheriff
Pie
Posts: 20771
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gilbert Ostlethwaite wrote:I'm working on a self-updating application that checks for updates at app startup. I've got the version checking and download of new .jars from the server working. How do I tell my app to restart itself?


Actually, what I just posted doesn't really make sense in the context of actually having read the original post.

If you're checking for updates at the time the application starts up, I don't see why you need to tell the application to restart itself at all. Wouldn't you just check for new versions, download them if present, and then start the application? If you're tasked with reinventing Web Start, then that's what Web Start does so that's what you should do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic