D:\tomcat8\bin>startup
Neither the JAVA_HOME nor the JRE_HOMEenvironment variable is defined
At least one of these environment variableis needed to run this program
解决方法:
先看Tomcat的目录bin下startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat。只要在(bin下)setclasspath.bat的开头声明环境变量.
加上红色的两句就好了(当然了路径 请填写你自己的)注意两个文件
一个是 JAVA_HOME
一个是 JRE_HOME……......
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law oragreed to in writing, software
rem distributed under the License isdistributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANYKIND, either express or implied.
rem See the License for the specificlanguage governing permissions and
rem limitations under the License.
rem---------------------------------------------------------------------------
rem Set JAVA_HOME or JRE_HOME if notalready set, ensure any provided settings
rem are valid and consistent with theselected start-up options and set up the
rem endorsed directory.
rem---------------------------------------------------------------------------
set JAVA_HOME=D:\Java\jdk1.8
set JRE_HOME=D:\Java\jdk1.8.0_121
rem Make sure prerequisite environmentvariables are set
rem In debug mode we need a real JDK(JAVA_HOME)
if ""%1"" ==""debug"" goto needJavaHome
……
:end
exit /b 0
最后startup 启动tomcat成功