将Web应用程序自动更新为没有启动器的服务

时间:2017-09-05 05:32:18

标签: install4j

如果应用程序是一个没有启动器的服务的Web应用程序,install4j中的自动更新功能是否有效?我尝试了很多网络资源提到的方法,但没有运气。请帮忙。我使用的是install4j Windows Edition 6.1.6。

编辑1: @Ingo Kegel,             我根据您的建议添加了-Dinstall4j.keepLog=true -Dinstall4j.alternativeLogfile=E:/install4j-log/log.txt并获得了以下日志。请帮忙。

[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

编辑2: 以下是执行代码后的日志(下载exe文件后) UpdateChecker.executeScheduledUpdate(Arrays.asList("-q"), false, null);

日志:

 [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

编辑3: 以下是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

enter image description here

编辑4: 我在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
    }

jstack错误如下: enter image description here

编辑5: 以下是jstack日志:

    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

编辑6: 以下是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 个答案:

答案 0 :(得分:2)

我建议更新到install4j 7,它具有很多新的自动更新功能,适用于服务。

使用install4j 7,您可以在Installer-&gt; Screen&amp;屏幕上添加“后台更新下载程序”应用程序。行动步骤。该应用程序模板中的关键操作是“计划更新安装”操作。

在您的服务中,您可以像这样启动更新下载程序:

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

在自己的线程中,<ID>被应用程序的ID替换。此调用阻止以及何时返回更新安装程序可能已下载。你可以用

检查这个条件
UpdateChecker.isUpdateScheduled()

现在您只需要触发下载的安装程序的执行。如果您不想终止服务,可以立即执行此操作,也可以在启动时执行此操作。您需要的代码段是:

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

作为更新安装的一部分,服务将关闭。服务无法自动重启(如果您将true作为第二个参数传递给上述方法调用,GUI启动器可以执行哪些操作)但必须以安装程序中可能已有的“启动服务”操作启动

有关更多信息和屏幕截图,请参阅

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

并搜索“后台自动更新”。