Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Ideas on "Auto-update"

Thread view: 
Ike - 08 Apr 2006 12:19 GMT
Im wondering how I might be able to implement an "auto update" type of
procedure. I have a server program, all packaged up in a jar file, running
on a corporate server. That server has firewall access to another server,
out on the internet, wherein I can put a new, updated version of that jar
file, if necessary.

What I'd like to figure out is if there is a means whereby I can 1. Stop the
server program from running so that 2. It can download the new incarnation
of itself and 3. Restart itself.

Anyone have any ideas on such a mechanism? Thanks, Ike
Andrey Kuznetsov - 09 Apr 2006 06:19 GMT
> Im wondering how I might be able to implement an "auto update" type of
> procedure. I have a server program, all packaged up in a jar file, running
[quoted text clipped - 8 lines]
>
> Anyone have any ideas on such a mechanism? Thanks, Ike

hmm, something like this (didn't tried it yet):

//from main programm (on windows, I am sure on Linux you can find something
similar to Start):
Runtime#exec("start java <myUpdateProgramm> -Dpath=<mainProgrammPath>");
System.exit(0);

//update programm
readNewVersion();
 int errorCount = 0;
while(true) {
   try {
        //try to save update
        saveUpdate(getUpdatePath());
        System.exit(0);
   }
   catch(UpdateFailedException ex) {
       //main programm still running?
       if(errorCount++ > MAX_ERROR_COUNT) {
           //something goes wrong
           System.exit(0);
       }
       Thread.sleep(5000);
   }
}

Andrey

Signature

http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities

Ike - 09 Apr 2006 18:05 GMT
Thanks Andrey -- that's damn near perfect, exactly what I was trying to do!
Thank you, Ike


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.