Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java self restart

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Sheriff
Posts: 26793
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 26793
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic