Updater not launching when application is a service

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
Post Reply
svkirans
Posts: 9
Joined: Sat Jan 25, 2020 7:48 am

Updater not launching when application is a service

Post by svkirans » Tue Jun 02, 2020 7:00 am

I am calling the updater from java code and the java application is running as a service. The java code for calling the updater is :

Code: Select all

public void CheckForUpdates() {
        boolean isUpdate = false;
        Thread thread = new Thread() {
            public void run() {
                    Runtime rt = Runtime.getRuntime();
                    String updater = System.getProperty("user.dir") + File.separator+"MyUpdater.exe";
                    String[] commands = {updater, "/justcheck"};
                    Process proc = rt.exec(commands);
                    int exitValue = proc.waitFor();
                    if(exitValue == 0){
                        doUpdates();
                    }
                
            }
        };
        thread.start();
    }

    public void doUpdates(){
        Thread thread = new Thread() {
            public void run() {
                    Runtime rt = Runtime.getRuntime();
                    String updater = System.getProperty("user.dir") + File.separator+"MyUpdater.exe";
                    File f = new File(updater);
                    if (f.exists()) {
                        rt.exec(updater);
                    }
            }
        };
        thread.start();
    }
When an update is available the aiu file is downloaded but the MSI or the updated exe is not downloaded.

However, when I double click the WorkClockUpdater.exe, the files are downloaded and the app is updated. Below is the aiu file that is created for the update.

Code: Select all

;aiu;

[myappUpdate]
Name = myapp
NoGUICommandLineSwitch = /exenoui /qn
ProductVersion = 1.0.15.0
URL = https://myappurl/downloads32/myapp_1.0.15.0.exe
Size = 113953141
MD5 = 1590253ad165cd0814b1653de368e515
ServerFileName = myapp_1.0.15.0.exe
Flags = Critical|SilentInstall|NoCache|Advertises|IsPatch
FilePath = [APPDIR]myapp.exe
Version = 1.0.15.0
Description = All

Any ideas on what I am missing here?

Daniel
Posts: 8142
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Updater not launching when application is a service

Post by Daniel » Wed Jun 03, 2020 2:19 pm

Hi,

Most likely this happens because your doUpdates() method is not launching the Updater silently. Please note that when launching a process within a service app the create child process cannot display any user interface. Therefore you should make sure the Updater does not display any UI, thus is being executed silently.

Could you please call the Updater.exe within your doUpdates() method using a command line like this:

Code: Select all

/silentall -nogui -nofreqcheck
and see how this works?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

svkirans
Posts: 9
Joined: Sat Jan 25, 2020 7:48 am

Re: Updater not launching when application is a service

Post by svkirans » Thu Jun 04, 2020 2:11 pm

I added the parameters as suggested by you, but it didn't help.

Code: Select all

 public void doUpdates(){
        Thread thread = new Thread() {
            public void run() {
                    Runtime rt = Runtime.getRuntime();
                    String updater = System.getProperty("user.dir") + File.separator+"MyUpdater.exe";
                    File f = new File(updater);
                    if (f.exists()) {
                        rt.exec(updater+" /silentall -nogui -nofreqcheck");
                    }
            }
        };
        thread.start();
    }

Any other options?

Daniel
Posts: 8142
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Updater not launching when application is a service

Post by Daniel » Fri Jun 05, 2020 2:04 pm

Hi,

Before calling the Updater with /silentall command, could you call it using a command like this:

Code: Select all

updater.exe /set loglevel "Error|Debug"
This way all subsequent Updater calls will create an updater.log file, inthe same updates download folder where the .AIU file is downloaded to.

Could you send us the updater.log file by email at support at advancedinstaller dot com so we can investigate it?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply