This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Knowledge Base
- :
- Create and Register a Windows Service through Custom Code
Subscribe
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Create and Register a Windows Service through Custom Code
Create and Register a Windows Service through Custom Code
Summary
This article discusses how to create and register a Windows service through Custom Code.Synopsis
This article discusses how to create and register a Windows service through Custom Code.Discussion
Here is a sample Custom Code snippet:public void install(InstallerProxy ip) throws InstallException { try { String myUserInstallDir = ip.substitute("$USER_INSTALL_DIR$"); Win32Service win32Service = (Win32Service) ip.getService(Win32Service.class); NTServiceConfig config = new NTServiceConfig(); config.setDisplayName("TrainingService"); config.setStartType(NTServiceConfig.SERVICE_AUTO_START); config.setErrorControl(NTServiceConfig.SERVICE_ERROR_NORMAL); JOptionPane.showMessageDialog(null,"USER_INSTALL_DIR="+myUserInstallDir+"\\TrainingService.exe"); config.setCommand(myUserInstallDir+"\\TestService.exe"); win32Service.createNTService("TestService", config); } catch (ServiceException ex) { JOptionPane.showMessageDialog(null, ex); } }
Note: This is only sample Custom Code, which is strictly for example purposes. The Custom Code should be customized and thoroughly tested before deployment into production.
Additional Information
For more information about Custom Code, click here.For documentation for the InstallAnywhere Custom Code API, click here.
Start or Stop a Windows Service Using Custom Code
How to Check the Status of a Windows Service
No ratings
Comments
Sep 13, 2019
01:20 PM
- Mark as Read
- Mark as New
- Permalink
- Report Inappropriate Content
Sep 13, 2019
01:20 PM
I cannot find which jar/zip file defined the Win32Service class. I know the main package used by Installanywhere is IAClasses.zip. But I cannot find this class in IAClasses.zip
Jul 07, 2020
01:27 AM
- Mark as Read
- Mark as New
- Permalink
- Report Inappropriate Content
Jul 07, 2020
01:27 AM
Are there example with installing with whitespace? or service that handles whitespace?
For example how to register service whose command line will be like below?
c:/my install roo/bin/custom.exe -nosplash=true -f 'c:/users/username/some another location/with.log'