?
Solved

How to update application when it is running ??

Posted on 2002-06-04
5
Medium Priority
?
192 Views
Last Modified: 2010-03-31
I want to update my pure java application when it is runing. I have a button called "update". When this button is clicked, it will download new version to temp folder for this application from server and update it. In detail, some of files for this application will be moved to backup folder and new files will be moved from temp folder to destination folder. I use below java classes to move files:
File oldf=new File("c:/../oldFile");
File newf=new File("c:/../newFile");
oldf.renameTo(newf);
My problem: When oldFile is not refered/referenced by application, this moving will be successful. If oldFile is refered/referenced by application, this moving will fail. How to handle this problem ??

When I plan to use System.exit(o), then, update application, when System.exit() is called , it shutdown everything. I cann't do anything. I cann't do update. How can I shutdown my application without using System.exit() ? so I can do update after shuting down app. Thanks for help
Gary
0
Comment
Question by:garyshi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Expert Comment

by:imladris
ID: 7054990
How about running it from a batch file. The batch file could contain a loop. In pseudo code something like:

Forever
   Run Java application
   Upgrade application


So that when you exit the application it gets updated, then the application is run again.
0
 
LVL 7

Expert Comment

by:tomboshell
ID: 7055575
What about a 'stand-in' application?  Another application that can start & stop your original app.  It would do the updating and could be in the same path. It doesn't even have to be a large program.
0
 
LVL 3

Expert Comment

by:oraelbis
ID: 7056578
I think, that you must create some Addin interface,
implement it in your plugable classes an dinamicaly load classes using your own extension API. Check your development tool for extension mechanism. May be you create you API something like it. For example in Oracle Java Developer realised the Addin interface for adding functionality to the Oracle Tools IDE.
0
 
LVL 9

Accepted Solution

by:
doronb earned 400 total points
ID: 7070565
Hi,


I'm working on something along the same lines. I have an application that can activate plugins. These
plugins are simple Java classes implementing a common Plugin interface.

When I want to update a plugin, the application receives a JAR file containing the new plugin code.
The application then attempts to close all live instances of the old plugin and then remove its JAR
file. Once the old JAR file is removed, I can replace it with the new JAR and load the new plugin.

In order to accomplish this, my plugins are loaded dynamically by my own ClassLoader. This enables me
to "deactivate-and-replace" live code. Keep in mind though that any references to the old plugin must
be null and void before swapping the code.


Hope this helps

Doron
0
 
LVL 35

Expert Comment

by:girionis
ID: 8833971
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- points to doronb

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month12 days, 21 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question