Skip navigation.

exploreopera

| Help

Sign up | Help

Posts tagged with "tomcat"

Run tomcat as a service under windows

windows下将tomcat作为服务运行。

如果你是用的installer安装的tomcat,会自动将Tomcat安装为系统服务了,只需要更改一下启动方式为automatic就行了。

但对于Tomcat的zip包,要经过下面的方法才能让它进行为windows服务。

1.运行: <tomcat dir>\bin\service install
2.将 <tomcat dir>\bin\tomcat5w.exe拖一个shortcut到桌面。
3.编辑这个快捷方式,后面加上参数://MS//
4.运行这个shortcut, 则服务监控出现在系统托盘了,下面改服务启动方式为authmatic就行了。

这样下次开机,tomcat就会自动运行了。

java.lang.OutOfMemoryError: Java heap space

遇到TOMCAT出错:java.lang.OutOfMemoryError: Java heap space,于是查了资料,找到了解决方法:

If Java runs out of memory, the following error occurs:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Java heap size can be increased as follows:

java -Xms<initial heap size> -Xmx<maximum heap size>
Defaults are:
java -Xms32m -Xmx128m

如果你用win
/tomcat/bin/catalina.bat 加上下面的命令:
set JAVA_OPTS=-Xms32m -Xmx256m

如果你用unix/linux
/tomcat/bin/catalina.sh 加上下面的命令:
JAVA_OPTS="-Xms32m -Xmx256m"