To install GlassFish 3.1 as a Window Service, you can use the create-service command. Follow these steps to setup the service:
Open an MS-DOS window (Run As Administrator)
[java]
cd {your_glassfish_home}\glassfish\bin
asadmin create-service –name domain1
[/java]
This will create the service. You can verify this is the Windows Services control panel. By default, the service display name is domain1 GlassFish Server.
If you would like to change the display name of the service, then you can execute the following command. Be sure to put a space between DisplayName=
and "GlassFish 3.1"
[java]
sc config domain1 DisplayName= "GlassFish 3.1"
[/java]
If you no longer need the Windows service, you can delete the service with this command.
[java]
sc delete domain1
[/java]
Also, you should delete all files in cd \glassfish\domains\domain1\bin
Additional documentation on the create-service command is available here.