
Starting Liferay as a Windows Service
Table of Contents [-]
Instructions #
From {tomcat_dir}/bin, type:
service install [service_name] (i.e. service install Liferay)
That will install Liferay as the service name, and register it as "Apache Tomcat Liferay" within Windows' Service viewer.
Then to edit, again in {tomcat_dir}/bin, simply type:
tomcat5w //ES//[service_name] (i.e. tomcat5w //ES//Liferay)
This will bring up a GUI where you can then change the service's settings. You will want to do the following:
In the Java tab:
Make sure "Use default" is unchecked. Point your Java Virtual Machine to:
C:\Program Files\Java\jdk1.5.0_08\jre\bin\server\jvm.dll
(obviously point this to the right version JDK that you have, as installation may differ)
Add the arguments to the Java Options:
-Dfile.encoding=UTF8 -Duser.timezone=GMT -Djava.security.auth.login.config={tomcat_dir}\conf\jaas.config
replacing the {tomcat_dir} with the full directory path of your liferay installation.
Change the Initial memory pool & Maximum memory pool to 512 and 1024 respectively.
In the Startup tab: (optional)
Change the working directory to the full directory path of the bin folder from your liferay installation (ex. : C:\Program Files\Liferay\Social Office 1.0b1\bin). This is handy when liferay's HSQLDB Database (lportal.script) is already in the bin folder (the default) and we still want to use it.
HSQLDB database #
If you are using HSQLDB as your database (the default) then you will either need to set the services' working directory or you could explicitly state where the HSQLDB files are located. To do this, edit the ROOT.xml configuration file in %TOMCAT_HOME%\conf\Catalina\localhost
Modify the url line to include the path to the HSQLDB database by adding ${catalina.home}/bin/
url="jdbc:hsqldb:**${catalina.home}/bin/**lportal"
Removing the Service #
To remove the window service for tomcat, which in this case is named 'Tomcat5'
tomcat5 //DS//[service_name] (i.e. service //DS//Liferay)
Other options #
Alternatively it is also possible to use JavaService: http://javaservice.objectweb.org/