Auto Update in Install4J - Software Update with Silent Version Check

When we have a programm running on multiple client PC and we need an Auto Update. For Java Install4J provides Installer which can be used on on any platform.


It is easy but very difficult as no clear help is available.



AutoUpdate.java


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package autoupdater;
import com.install4j.api.launcher.*;
import com.install4j.api.update.*;
import com.install4j.api.Util;
import javax.swing.JOptionPane;


/**
*
* @author rehmanm
*/
public class AutoUpdate {
static AutoUpdate AutoUpdateObj;
public static AutoUpdate getInstance(){

if (AutoUpdateObj ==null)
AutoUpdateObj = new AutoUpdate();

return AutoUpdateObj;
}
private AutoUpdate(){

}
public void Update(){
try {

JOptionPane.showMessageDialog(null, "Download Location " + Util.getUserHome());




JOptionPane.showMessageDialog(null, "Possible Entry : " + UpdateChecker.getUpdateDescriptor("http://localhost/website/updates.xml",
ApplicationDisplayMode.GUI).getPossibleUpdateEntry());
// Location where Updateable version is available
if (UpdateChecker.getUpdateDescriptor("http://localhost/
website/updates.xml",
ApplicationDisplayMode.GUI).getPossibleUpdateEntry() != null) {

//Process_ID is the ID of Installer - In my case it is 61
//Install4J Package Image
ApplicationLauncher.launchApplication("Process_ID", null, false, new ApplicationLauncher.Callback() {

public void exited(int exitValue) {


JOptionPane.showMessageDialog(null, "exited" + exitValue);
//java.lang.System.exit(exitValue);

}
public void prepareShutdown() {

JOptionPane.showMessageDialog(null, "prepareShutdown");
//Method shutdown the application
}

});


}
} catch(Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, ex.getMessage());
}
JOptionPane.showMessageDialog(null, "End");
}






}


Things to remember.

Please provide the complete path with xmlfile name in Update Descriptor URL as mentioned in the image.









Include i4jrunimte.jar in your project can be found in the installation directory in resource folder.

In my computer it is C:\Program Files\install4j\resource\i4jruntime.jar. It may be changed in your system.

Comments

Meg Kelsey said…
once you have AutoUpdater.java written, how do you use it in install4j?
Meg Kelsey said…
This comment has been removed by the author.
IBCRACKS said…
It was a lot of fun and I really enjoyed myself It is a great website and nice share. I want to thank you. Good job! You guys do a great blog and have some great contents. Keep up the good work Really impressed! Everything is very open and very clear clarification of issues. It contains true facts. Your website is very valuable. Thanks for sharing.
Install4J Crack
zara said…
If you want to download this software check my site https://crackhomes.co/2021/02/13/install4j-crack-download/


I like your all post. You have done really good work. Thank you for the information you provide, it helped me a lot. I hope to have many more entries or so from you.
Very interesting blog.
visual-studio-code-crack
install4j-crack

Popular posts from this blog

Ping For All OS

Create Silverlight Enabled Service