• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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: 28328
96
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: 28328
96
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.
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic