1. 确保你的domain存在,如:domain1
2. 进入asadmin
3. 运行命令:asadmin> create-service domain1
4. Glassfish会为你在你的domain下的bin目录中生成service包裹文件
asadmin> create-service domain1
The Windows Service was created successfully. It is ready to be started. Here are the details:
ID of the service: domain1
Display Name of the service:domain1 GlassFish Server
Server Directory: D:\payara41\glassfish\domains\domain1
Configuration file for Windows Services Wrapper: D:\payara41\glassfish\domains\domain1\bin\domain1Service.xml
The service can be controlled using the Windows Services Manager or you can use the
Windows Services Wrapper instead:
Start Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe start
Stop Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe stop
Restart Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe restart
Uninstall Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe uninstall
Install Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe install
Status Command: D:\payara41\glassfish\domains\domain1\bin\domain1Service.exe status
You can also verify that the service is installed (or not) with sc query state= all
windows.services.uninstall.good=Found the Windows Service and successfully uninstalled it.
For your convenience this message has also been saved to this file: D:\payara41\glassfish\domains\domain1\PlatformServic
es.log
Command create-service executed successfully.
5. 查看生成的服务:sc query domain1
6. 提示中明确给出了此服务的运行、停止、重启、卸载、安装、状态查看的命令行运行方式
7. 完毕
其他操作系统下的生成方式类似,glassfish的资料里面全有的。。。