本人多次碰到这个问题,在网上搜索很久,一直没有找到真正的解决方法。今天下午一次偶然的机会发现了问题所在,根据问题,提出以下解决方案。问题所在:现在很多人都在使用jdk的压缩版,使得tomcat服务不能正确设置javaVM,导致tomcat服务不能正常配置和启动。如果你是安装版jdk也出现启动问题,请参照以下方法解决。假设jdk安装目录为d:\j2sdktomcat5安装目录为D:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.01.配置环境变量:JAVA_HOME=d:\j2sdkCLASSPATH=%JAVA_HOME%\bin;.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jarCATALINA_HOME=D:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.02.配置Tomcat服务这里有两种情况,一是tomcat5为安装版,二是解压版,针对这两种情况分别解决。(1)安装版tomcat5在安装时选择安装tomcat服务,如图安装完成后,打开注册表regedit.exe,找到HKEY_LOCAL_MACHINE\SOFTWARE\ApacheSoftwareFoundation\TomcatServiceManager\Tomcat5\Parameters,你可以看到里面有很多参数值,主要是修改Java项的值为d:\j2sdk\jre\bin\server\jvm.dll,修改正确后,你就可以通过开始-程序-ApacheTomcat5.0-starttomcat启动服务了。若没有若没有此项,可以依照以下方法设置参数。(2)解压版tomcat5这时你要先配置服务所用的参数,启动命令是tomcat5的bin目录下的tomcatw.exe(后面附上tomcatw.exe命令参数)。如果不存在HKEY_LOCAL_MACHINE\SOFTWARE\ApacheSoftwareFoundation\TomcatServiceManager\Tomcat5\Parameters,请先创建,这一步是关键。使用命令tomcatw.exe//ES//Tomcat5打开配置窗口,如下设置参数如下:Service栏Description=ApacheTomcat5.0(这个可以随便写)ImagePath=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\bin\bootstrap.jarWorkPath=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0AutoStart这个参数允许设置服务为自动启动JavaVM栏:Auto不要打勾JavaVM=D:\j2sdk\jre\bin\server\jvm.dllJavaOptions=-Dcatalina.home=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0-Djava.endorsed.dirs=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\common\endorsed-XrsStartClass=org/apache/catalina/startup/Bootstrap;main;startStopClass=org/apache/catalina/startup/Bootstrap;main;stopStandardStreams:只要设置两项Output=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\logs\stdout.logError=d:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\logs\stderr.log根据以上设置,接下来可以使用tomcatw.exe//GT//Tomcat5启动服务了。若有问题可以给我留言或者加我QQ:4034348TOMCAT5在WINDOWS下的一些命令行TomcatwmonitorapplicationTomcatwisaGUIapplicationformonitoringandconfiguringTomcatservices.Theavailablecommandlineoptionsare://ES//EditserviceconfigurationThisisthedefaultoperation.ItiscalledifthenooptionisprovidedbuttheexecutableisrenamedtoservicenameW.exe//MS//MonitorservicePuttheiconinthesystemtryCommandlineargumentsEachcommandlinedirectiveisintheformof//XX//ServiceNameTheavailablecommandlineoptionsare://TS//RuntheserviceasconsoleapplicationThisisthedefaultoperation.Itiscalledifthenooptionisprovided.TheServiceNameisthenameoftheexecutablewithoutexesufix,meaningTomcat5//RS//RuntheserviceCalledonlyfromServiceManager//SS//Stoptheservice//US//Updateserviceparameters//IS//Installservice//DS//DeleteserviceStopstheserviceifrunningCommandlineparametersEachcommandparameterisprefixedwith--.Ifthecommandlineisprefixedwith++thenit'svaluewillbeappendedtotheexistingoption.IftheenvironmentvariablewiththesamenameascommandlineparameterbutprefixedwithPR_existsitwilltakeprecedence.Forexample:setPR_CLASSPATH=xx.jarisequivalenttoproviding--Classpath=xx.jarascommandlineparameter.ParameterNameDefaultDescription--DescriptionServicenamedescription(maximum1024characters)--DisplayNameServiceNameServicedisplayname--Installprocrun.exe//RS//ServiceNameInstallimage--StartupmanualServicestartupmodecanbeeitherautoormanual--DependsOnListofservicesthatthisservicedependon.Dependentservicesareseparatedusingeither#or;characters--EnvironmentListofenvironmentvariablesthatwillbeprovidedtotheserviceintheformkey=value.Theyareseparatedusingeither#or;characters--UserUseraccountusedforrunningexecutable.ItisusedonlyforStartModejavaorexeandenablesrunningapplicationsasserviceunderaccountwithoutLogonAsServiceprivilege.--PasswordPasswordforuseraccountsetby--Userparameter--JavaHomeJAVA_HOMESetadifferentJAVA_HOMEthendefinedbyJAVA_HOMEenvironmentvariable--JvmautoUseeitherautoorspecifythefullpathtothejvm.dll.Youcanusetheenvironmentvariableexpansionhere.--JvmOptions-XrsListofoptionsintheformof-Dor-XthatwillbepassedtotheJVM.Theoptionsareseparatedusingeither#or;characters.--ClasspathSettheJavaclasspath--JvmMsInitialmemorypoolsizeinMB--JvmMxMaximummemorypoolsizeinMB--JvmSsThreadstacksizeinKB--StartImageExecutablethatwillberun.--StartPathWorkingpathforthestartimageexecutable.--StartClassClassthatwillbeusedforstartup.--StartParamsListofparametersthatwillbepassedtoeitherStartImageorStartClass.Parametersareseparatedusingeither#or;character.--StartMethodMainMethodnameifdiffersthenmain--StartModeexecutableCanoneofjvmjavaorexe--StopImageExecutablethatwillberunonStopservicesignal.--StopPathWorkingpathforthestopimageexecutable.--StopClassClassthatwillbeusedonStopservicesignal.--StopParamsListofparametersthatwillbepassedtoeitherStopImageorStopClass.Parametersareseparatedusingeither#or;character.--StopMethodMainMethodnameifdiffersthenmain--StopModeexecutableCanoneofjvmjavaorexe--StopTimeoutNoTimeoutDefinesthetimeoutinsecondsthatprocrunwaitsforservicetoexitgracefully.--LogPathworkingpathDefinesthepathforlogging--LogPrefixjakarta_serviceDefinestheservicelogfilename--LogLevelINFODefinesthelogginglevelandcanbeeithererror,info,warnordebug--StdOutputRedirectedstdoutfilename--StdErrorRedirectedstderrfilenameInstallingserv