Run asadmin. Bat create-service on the command line.
Remember to run as an administrator.
In this way, the registered service may not be stopped when it is stopped, at least on win7. You need to manually execute the Stop command
I found that this problem is very serious, probably because my JDK is not an installed version. After the computer is restarted, if I do not log on, the service will still be unavailable.
Google. The solution is as follows:
1. Enter the command line as an administrator.
2. Delete the installed Service SC Delete domain1 (your service ID)
3. Go to glassfish \ Domains \ domain1 \ bin in the installation directory of glassfish.
4. Modify the domain1service. xml file, add <env name = "as_java" value = "D:/Java/jdk1.7.0 _ 05"/>, and set JDK. This line only needs to be a level-1 sub-tag of <service> </service>.
5. Return to the command line to add the service. The SC create service name-binpath = is the EXE file in the same directory as domain1service. xml. Write the file to determine the path.
In this way, the success is achieved.
Note-binpath = must be followed by spaces.
The above method adds glassfish to the service, and there is no problem. The following problem is that if you do not log on to the glassfish system after the restart, it will automatically start. This is because of JVM. So after glassfish is started, add it to the JVM option.
The parameter "-xrs" is enough.
On the Internet, it is also said that if it is a 2003 system
The glassfish \ Lib \ processlauncher. xml file, which is added to the <process name = "as9-server"> tag:
<Sysproperty key = "-xrs"/> --------------------------------- install. NET Framework on 2003, or report glassfish creation failure return 128