Tomcat手动启动/部署[非安装版]
写在前面的话:
以前做JavaWeb开发时习惯了,用Eclipse或者Idea等开发工具开发,调试代码. 基本上以来工具的Tomcat插件就很方便的实现了项目的发布/启动.
后来, 想自己写一些静态页面时,不知道如何手动去部署/启动Tomcat,网上找了下,似乎不是那么容易找到.这里自己备注一下, 以便下次查阅.
*确保自己JDK已经安装好, 即已经配置好Java环境, 验证是否已安装:命令窗口执行:java -version 可成功执行,显示自己安装JDK的版本即表示已配置java环境.
- 将自己要部署的项目打成war包/静态页面,将war包/静态页面放置在tomcat的webapps包下面
…\Apache\Tomcat\apache-tomcat-7.0.64\webapps
类似这样的目录下
然后找到bin目录下startup.bat,并编辑,加入:set JAVA_HOME=H:\Program Files\java\jdk1.8
@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem ---------------------------------------------------------------------------
setlocal
rem Guess CATALINA_HOME if not defined
set JAVA=H:\Program Files\java\jdk1.8
set "CURRENT_DIR=%cd%"
如上所示,然后保存关闭,右键以管理员身份启动该bat文件即可
然后在浏览中输入 localhost:8080/hello.html