• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Another reason to want to restart java from java

 
Ranch Hand
Posts: 334
2
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought a new thread was warranted because my situation is a bit different.

I have only been thinking about this and haven't started to implement it yet. I have several programs that check if an update is available. Right now they just tell you and it's your job to download an unpack the jars.

It would be kind of cool if it behaved like Firefox or TBird and downloaded the archive in the background then popup a dialog and say you have to restart to get the new version, press this button to do it now.

I'm wondering how others do that? I'm not comfortable overwriting jar files of a running program. I can think of a few possibilities but would like to hear about something that has worked before.

Thanks,
Joe
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While restarting a native app (like Firefox) is probably necessary to pick up updates, in Java you can avoid this using OSGi. Unloading parts of an app during runtime (in the shape of jar files called "bundles"), and replacing them with newer versions is one of the fundamental use cases for OSGi. The name of the jar file wouldn't be relevant, so nothing would get overwritten.

If I wanted to do this without resorting to OSGi, I'd check out if Runtime.exec or ProcessBuilder can start subprocesses that continue to run if the parent process is terminated. But OSGi would definitely be my first choice.
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The requirement as stated is just what JNLP/Webstart allows!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point. I was thinking more along the lines of replacing individual bits and pieces of an app (which is how the Firefox update mechanism works), and being able to control that process. If it's acceptable to replace the entire app with whatever the latest version is (sort of like it works for mobile apps), then Webstart makes that quite easy.
 
Joe Areeda
Ranch Hand
Posts: 334
2
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.

I will learn about OSGI.

Javaws/JNLP has its place but I tend to prefer apps that are downloaded once and started locally that way the procedure doesn't change every time Apple looks at Java.

Thanks again.

Joe
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Areeda wrote:
Javaws/JNLP has its place but I tend to prefer apps that are downloaded once and started locally that way the procedure doesn't change every time Apple looks at Java.



Your understanding of Webstart is flawed. It is easy to configure Webstart so that an application is started locally with only the modified resources downloaded.
 
Joe Areeda
Ranch Hand
Posts: 334
2
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Tookey wrote:

Joe Areeda wrote:
Javaws/JNLP has its place but I tend to prefer apps that are downloaded once and started locally that way the procedure doesn't change every time Apple looks at Java.



Your understanding of Webstart is flawed. It is easy to configure Webstart so that an application is started locally with only the modified resources downloaded.



thanks! I'll dig into that.
 
Politics n. Poly "many" + ticks "blood sucking insects". 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