Auto update for web app as a service with no launcher

半腔热情 提交于 2020-01-13 19:42:12

问题


Does auto update functionality in install4j work if the the app is a web app as a service which has no launcher? I have tried many ways mentioned in web resources but no luck. Please help. I am using install4j Windows Edition 6.1.6.

Edit 1: @Ingo Kegel, I added -Dinstall4j.keepLog=true -Dinstall4j.alternativeLogfile=E:/install4j-log/log.txt as per your suggestion and got the below log. Please help.

[INFO] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 630]: Execute action
       Property script: com.install4j.script.I4jScript_Internal_38
       Property variableName: updateDescriptorEntry
       Property failIfNull: true
       Property onlyIfUndefined: false
       Property responseFileVariable: false
       Property rollbackSupported: false
[ERROR] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 630]: Execute action not successful after 4 ms

EDIT 2: Below are the logs after executing code (After the exe file has been downloaded) UpdateChecker.executeScheduledUpdate(Arrays.asList("-q"), false, null);

Logs:

 [INFO] com.install4j.runtime.beans.actions.update.CheckForUpdateAction [ID 629]: Execute action
   Property connectTimeout: 10000
   Property connectionFailureScript: null
   Property readTimeout: 20000
   Property requestHeaders: []
   Property url: http://localhost:8181/astra-downloads/updates.xml
   Property variable: updateDescriptor
   Property acceptAllCertificates: false
   Property askForProxy: true
   Property rollbackSupported: false
   Property showError: true
   Download: http://localhost:8181/astra-downloads/updates.xml to C:\WINDOWS\TEMP\i4jupd4650856858406689282.xml; size: 366 bytes
   Variable changed: updateDescriptor=com.install4j.runtime.installer.config.update.UpdateDescriptorImpl@82c94f[class com.install4j.runtime.installer.config.update.UpdateDescriptorImpl]
   Execute action successful after 44 ms
[INFO] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 630]: Execute action
   Property script: com.install4j.script.I4jScript_Internal_63
   Property variableName: updateDescriptorEntry
   Property failIfNull: true
   Property onlyIfUndefined: false
   Property responseFileVariable: false
   Property rollbackSupported: false
   Branch 1
   3.0.1
   Variable changed: updateDescriptorEntry=UpdateDescriptorEntry [target: 22, file: GreytipAstra_windows_3_0_1.exe][class com.install4j.runtime.installer.config.update.UpdateDescriptorEntryImpl]
   Execute action successful after 4 ms
[INFO] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 632]: Execute action
   Property script: com.install4j.script.I4jScript_Internal_65
   Property variableName: updaterNewVersion
   Property failIfNull: false
   Property onlyIfUndefined: false
   Property responseFileVariable: false
   Property rollbackSupported: false
   Variable changed: updaterNewVersion=3.0.1[class java.lang.String]
   Execute action successful after 0 ms
[INFO] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 633]: Execute action
   Property script: com.install4j.script.I4jScript_Internal_66
   Property variableName: updaterDownloadUrl
   Property failIfNull: false
   Property onlyIfUndefined: false
   Property responseFileVariable: false
   Property rollbackSupported: false
   Variable changed: updaterDownloadUrl=http://localhost:8181/astra-downloads/GreytipAstra_windows_3_0_1.exe[class java.lang.String]
   Execute action successful after 0 ms
[INFO] com.install4j.runtime.beans.actions.control.SetVariableAction [ID 634]: Execute action
   Property script: com.install4j.script.I4jScript_Internal_67
   Property variableName: updaterDownloadFile
   Property failIfNull: false
   Property onlyIfUndefined: false
   Property responseFileVariable: false
   Property rollbackSupported: false
   Variable changed: updaterDownloadFile=C:/Users/Abhishek/Downloads\GreytipAstra_windows_3_0_1.exe[class java.lang.String]
   Execute action successful after 0 ms
[INFO] com.install4j.runtime.beans.actions.net.DownloadFileAction [ID 635]: Execute action
   Property connectTimeout: 10000
   Property connectionFailureScript: null
   Property md5Url: 
   Property readTimeout: 20000
   Property requestHeaders: []
   Property targetFile: C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe
   Property url: http://localhost:8181/astra-downloads/GreytipAstra_windows_3_0_1.exe
   Property acceptAllCertificates: false
   Property askForProxy: true
   Property checkForMd5Sums: false
   Property deleteOnExit: false
   Property dontAskForRetry: false
   Property retryIfInterrupted: true
   Property rollbackSupported: false
   Property showError: true
   Property showFileName: true
   Property showProgress: true
   Download: http://localhost:8181/astra-downloads/GreytipAstra_windows_3_0_1.exe to C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe; size: 43569152 bytes
   Execute action successful after 2640 ms
[INFO] com.install4j.runtime.beans.actions.files.SetModeAction [ID 637]: Execute action
   Property directoryFilter: null
   Property fileFilter: null
   Property fileTarget: everything
   Property files: [C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe]
   Property filesRoot: null
   Property mode: 755
   Property recursive: false
   Property rollbackSupported: true
   Property showFileNames: true
   Property showProgress: false
   Execute action successful after 0 ms
[INFO] com.install4j.runtime.beans.actions.update.ScheduleUpdateAction [ID 638]: Execute action
   Property arguments: []
   Property installerFile: C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe
   Property maxCancelCount: 10
   Property maxTries: 3
   Property version: 3.0.1
   Property rollbackSupported: false
   Execute action successful after 3 ms
[INFO] com.install4j.runtime.beans.screens.StartupScreen [ID 627]: command: move 1 screens, executing actions, checking condition
[INFO] cleaning up
[INFO] Finished

EDIT 3: Below is the logs of UpdateChecker.executeScheduledUpdate(Arrays.asList("-q","-Dinstall4j.keepLog=true","-Dinstall4j.alternativeLogfile=E:/install4j-log/log2.txt"), false, null);

[INFO] logger started at Fri Sep 15 15:27:01 IST 2017
[INFO] executable name: C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe
[INFO] install4j version: 6.1.6 (build 6459)
[INFO] Properties: 
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
exe4j.moduleName=C:\Users\Abhishek\Downloads\GreytipAs...
sun.boot.library.path=c:\windows\temp\e4j101b.tmp_dir150546...
exe4j.semaphoreName=Local\c:_users_abhishek_downloads_gre...
java.vm.version=24.80-b11
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
exe4j.consoleCodepage=cp0
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.script=
user.country=US
sun.os.patch.level=
install4j.exeDir=C:\Users\Abhishek\Downloads\
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\WINDOWS\TEMP\e4j101B.tmp_dir150546...
java.runtime.version=1.7.0_80-b15
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=c:\windows\temp\e4j101b.tmp_dir150546...
os.arch=x86
java.io.tmpdir=C:\WINDOWS\TEMP\
line.separator=

java.vm.specification.vendor=Oracle Corporation
user.variant=
exe4j.tempDir=C:\WINDOWS\TEMP\e4j101B.tmp_dir150546...
os.name=Windows NT (unknown)
sun.java2d.noddraw=true
sun.jnu.encoding=Cp1252
java.library.path=C:\WINDOWS\TEMP\e4j101B.tmp_dir150546...
sun.awt.enableExtraMouseButtons=true
java.specification.name=Java Platform API Specification
java.class.version=51.0
sun.management.compiler=HotSpot Client Compiler
install4j.language=en
exe4j.isInstall4j=true
os.version=10.0
install4j.updateStorageDir=C:\WINDOWS\system32\config\systemprof...
user.home=C:\Windows\System32\config\systemprofile
user.timezone=Asia/Calcutta
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.7
file.encoding=Cp1252
user.name=ABHISHEK-PC$
java.class.path=C:\WINDOWS\TEMP\e4j101B.tmp_dir150546...
java.vm.specification.version=1.7
sun.arch.data.model=32
java.home=c:\windows\temp\e4j101b.tmp_dir150546...
sun.java.command=C:\Users\Abhishek\Downloads\GreytipAs...
exe4j.launchName=C:\Users\Abhishek\DOWNLO~1\GREYTI~1.EXE
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
exe4j.unextractedPosition=26515602
java.version=1.7.0_80
java.ext.dirs=c:\windows\temp\e4j101b.tmp_dir150546...
sun.boot.class.path=c:\windows\temp\e4j101b.tmp_dir150546...
java.vendor=Oracle Corporation
install4j.appDir=C:\Windows\Temp\
file.separator=\
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
install4j.alternativeLogfile=E:/install4j-log/log2.txt
install4j.lockFile=C:\WINDOWS\system32\config\systemprof...
install4j.keepLog=true
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m...
[INFO] com.install4j.runtime.beans.actions.misc.RequestPrivilegesAction [ID 304]: Execute action
       Property allRequested: false
       Property failIfNotRootUnix: true
       Property obtainIfAdminMac: false
       Property obtainIfNormalWin: false
       Property obtainIfNormalMac: false
       Property obtainIfAdminWin: true
       Property failIfNotObtainedWin: true
       Property failIfNotObtainedMac: true
       Property rollbackSupported: false
       Execute action successful after 1 ms
[INFO] com.install4j.runtime.beans.screens.StartupScreen [ID 1]: command: move 1 screens, executing actions, checking condition
[INFO] com.install4j.runtime.beans.screens.WelcomeScreen [ID 2]: Show screen
[INFO] checking writable with maximum
[INFO] com.install4j.runtime.beans.screens.WelcomeScreen [ID 2]: thread name AWT-EventQueue-0

EDIT 4: My code in Application:

try {
        ApplicationLauncher.launchApplication("626", null, false, new ApplicationLauncher.Callback() {
                public void exited(int exitValue) {
                    //TODO add your code here (not invoked on event dispatch thread)
                    log.debug("******Exited "+exitValue+"********");
                    log.debug("****Inside block UpdateChecker.isUpdateScheduled() "+String.valueOf(UpdateChecker.isUpdateScheduled()));

                    boolean updateScheduled=UpdateChecker.isUpdateScheduled();


                    if(updateScheduled){
                        log.debug("***************Running UpdateChecker.executeScheduledUpdate*******************");
                        UpdateChecker.executeScheduledUpdate(Arrays.asList("-q","-Dinstall4j.keepLog=true","-Dinstall4j.alternativeLogfile=E:/install4j-log/log2.txt"), false, null);
                        log.debug("***************Completed UpdateChecker.executeScheduledUpdate*******************");
                    }
                }

                public void prepareShutdown() {
                    //TODO add your code here (not invoked on event dispatch thread)
                    log.debug("******prepare shut down********");
                }
            }
        );

    } catch (IOException e) {
        e.printStackTrace();
        //TODO handle invocation failure
    }

And the jstack error is as below:

EDIT 5: Below is the jstack log:

    2017-09-18 17:31:12
Full thread dump Java HotSpot(TM) Client VM (24.80-b11 mixed mode):

"TimerQueue" daemon prio=6 tid=0x17ecec00 nid=0x3708 waiting on condition [0x1861f000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x03850980> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
    at java.util.concurrent.DelayQueue.take(Unknown Source)
    at javax.swing.TimerQueue.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - <0x03884b18> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)

"AWT-EventQueue-0" prio=6 tid=0x17d3f000 nid=0x2670 waiting on condition [0x1841e000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x08ca4218> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source)
    at java.awt.EventQueue.getNextEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Windows" daemon prio=6 tid=0x17d2fc00 nid=0x40c runnable [0x1838f000]
   java.lang.Thread.State: RUNNABLE
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"AWT-Shutdown" prio=6 tid=0x17d2f400 nid=0xe68 in Object.wait() [0x182ff000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x08c79758> (a java.lang.Object)
    at java.lang.Object.wait(Object.java:503)
    at sun.awt.AWTAutoShutdown.run(Unknown Source)
    - locked <0x08c79758> (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Java2D Disposer" daemon prio=10 tid=0x17d2ec00 nid=0x3d64 in Object.wait() [0x1826f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x08c797e8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked <0x08c797e8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.java2d.Disposer.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Service Thread" daemon prio=6 tid=0x1783bc00 nid=0x468 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"C1 CompilerThread0" daemon prio=10 tid=0x1783a000 nid=0x1768 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Attach Listener" daemon prio=10 tid=0x17837800 nid=0x389c waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Signal Dispatcher" daemon prio=10 tid=0x17835400 nid=0x3258 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
    - None

"Finalizer" daemon prio=8 tid=0x0101a800 nid=0x4394 in Object.wait() [0x033bf000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x08ab74f8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked <0x08ab74f8> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

   Locked ownable synchronizers:
    - None

"Reference Handler" daemon prio=10 tid=0x01015800 nid=0x3d50 in Object.wait() [0x0127f000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x08ab7588> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:503)
    at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
    - locked <0x08ab7588> (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
    - None

"main" prio=6 tid=0x010ac400 nid=0x3138 in Object.wait() [0x00798000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x038517d0> (a com.install4j.runtime.installer.controller.CommandSink)
    at java.lang.Object.wait(Object.java:503)
    at com.install4j.runtime.installer.controller.Controller.start(Controller.java:87)
    - locked <0x038517d0> (a com.install4j.runtime.installer.controller.CommandSink)
    at com.install4j.runtime.installer.Installer.runInProcess(Installer.java:59)
    at com.install4j.runtime.installer.Installer.main(Installer.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:65)
    at com.exe4j.runtime.WinLauncher.main(WinLauncher.java:101)
    at com.install4j.runtime.launcher.WinLauncher.main(WinLauncher.java:26)

   Locked ownable synchronizers:
    - None

"VM Thread" prio=10 tid=0x01012400 nid=0x1bf0 runnable 

"VM Periodic Task Thread" prio=10 tid=0x17856000 nid=0x2fdc waiting on condition 

JNI global references: 449

EDIT 6: Below is the log of UpdateChecker.executeScheduledUpdate(Arrays.asList("-q","-Dinstall4j.keepLog=true","-Dinstall4j.alternativeLogfile=E:/install4j-log/log2.txt"), false, null);:

[INFO] logger started at Tue Sep 19 11:20:00 IST 2017
[INFO] executable name: C:\Users\Abhishek\Downloads\GreytipAstra_windows_3_0_1.exe
[INFO] install4j version: 7.0.1 (build 7043)
[INFO] Properties: 
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
exe4j.moduleName=C:\Users\Abhishek\Downloads\GreytipAs...
sun.boot.library.path=c:\windows\temp\e4j554d.tmp_dir150580...
exe4j.semaphoreName=Local\c:_users_abhishek_downloads_gre...
java.vm.version=24.80-b11
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
exe4j.consoleCodepage=cp0
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.script=
user.country=US
sun.os.patch.level=
install4j.exeDir=C:\Users\Abhishek\Downloads\
java.vm.specification.name=Java Virtual Machine Specification
user.dir=C:\WINDOWS\TEMP\e4j554D.tmp_dir150580...
java.runtime.version=1.7.0_80-b15
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=c:\windows\temp\e4j554d.tmp_dir150580...
os.arch=x86
java.io.tmpdir=C:\WINDOWS\TEMP\
line.separator=

java.vm.specification.vendor=Oracle Corporation
user.variant=
exe4j.tempDir=C:\WINDOWS\TEMP\e4j554D.tmp_dir150580...
os.name=Windows NT (unknown)
sun.java2d.noddraw=true
sun.jnu.encoding=Cp1252
java.library.path=C:\WINDOWS\TEMP\e4j554D.tmp_dir150580...
sun.awt.enableExtraMouseButtons=true
java.specification.name=Java Platform API Specification
java.class.version=51.0
sun.management.compiler=HotSpot Client Compiler
install4j.language=en
exe4j.isInstall4j=true
os.version=10.0
install4j.updateStorageDir=C:\WINDOWS\system32\config\systemprof...
user.home=C:\Windows\System32\config\systemprofile
user.timezone=Asia/Calcutta
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.specification.version=1.7
file.encoding=Cp1252
user.name=ABHISHEK-PC$
java.class.path=C:\WINDOWS\TEMP\e4j554D.tmp_dir150580...
java.vm.specification.version=1.7
sun.arch.data.model=32
java.home=c:\windows\temp\e4j554d.tmp_dir150580...
sun.java.command=C:\Users\Abhishek\Downloads\GreytipAs...
exe4j.launchName=C:\Users\Abhishek\DOWNLO~1\GREYTI~1.EXE
java.specification.vendor=Oracle Corporation
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
exe4j.unextractedPosition=25300990
java.version=1.7.0_80
java.ext.dirs=c:\windows\temp\e4j554d.tmp_dir150580...
sun.boot.class.path=c:\windows\temp\e4j554d.tmp_dir150580...
java.vendor=Oracle Corporation
install4j.appDir=C:\Windows\Temp\
file.separator=\
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
install4j.alternativeLogfile=E:/install4j-log/log2.txt
install4j.lockFile=C:\WINDOWS\system32\config\systemprof...
install4j.keepLog=true
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m...
[INFO] com.install4j.runtime.beans.actions.misc.RequestPrivilegesAction [ID 304]: Execute action
       Property allRequested: false
       Property failIfNotObtainedMac: true
       Property failIfNotObtainedWin: true
       Property failIfNotRootUnix: true
       Property obtainIfAdminMac: false
       Property obtainIfAdminWin: true
       Property obtainIfNormalMac: false
       Property obtainIfNormalWin: false
       Property rollbackSupported: false
       Property updateInstallationDirectory: true
       Execute action successful after 1 ms
[INFO] com.install4j.runtime.beans.screens.StartupScreen [ID 1]: command: move 1 screens, executing actions, checking condition
[INFO] com.install4j.runtime.beans.screens.WelcomeScreen [ID 2]: Show screen
[INFO] checking writable with maximum

回答1:


I would recommend updating to install4j 7 which has a lot of new auto-update functionality which works well for services.

With install4j 7, you add a "Background update downloader" application on the Installer->Screen & Actions step. The key action in that application template is the "Schedule update installation" action.

In your service, you launch the update downloader like this:

ApplicationLauncher.launchApplication("<ID>", null, true, null);

in its own thread where <ID> is replaced with the ID of the application. This call blocks and when it returns an update installer may have been downloaded. You can check this condition with

UpdateChecker.isUpdateScheduled()

Now you only need to trigger the execution of the downloaded installer. You can either do that immediately, or at startup if you do not want to terminate the service. The code snippet you need is this:

UpdateChecker.executeScheduledUpdate(Arrays.asList("-q"), false, null);

As part of the update installation, services are shut down. Services cannot auto-restart (which GUI launchers could do if you passed true as the second parameter to the above method call) but have to be started with a "Start a service" action which you probably already have in your installer.

For more information and screen shots, see

https://www.ej-technologies.com/products/install4j/whatsnew7.html

and search for "Background auto-update".



来源:https://stackoverflow.com/questions/46047591/auto-update-for-web-app-as-a-service-with-no-launcher

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!