1.配置项目在服务器上,要先确定的是搭建的系统环境,是否满足java和tomcat环境的配置
2.我们首先要确定java环境安装jdk,可在官网里下载:http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
"计算机"->"属性"->"高级"->"环境变量"->系统变量下的"新建"->变量名:JAVA_HOME 变量值C:\Program Files\Java\jdk1.7.0_55;
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_55;
path=%JAVA_HOME%\bin;
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tool.jar;
然后在cmd里输入javac看是否安装成功
3.配置tomcat环境的配置,其实和配置Java环境差不多
Tomcat的安装与配置
1、解压下载文件包,不习惯版本号文件夹,在这里我修改默认文件夹名apache-tomcat-8.0.0-RC5-windows-x64为tomcat。请同学们根据自己的意愿选择。
配置Tomcat环境变量
2、打开系统环境变量请参考第三步图示操作。
在系统变量中添加以下变量
1)新建TOMCAT_HOME变量
变量名TOMCAT_HOME
变量值c:\tomcat
变量值即为我们下载的tomcat解压路径,在这里我的是c:\tomcat,如果有疑惑,可以参考第五步。
2)新建CATALINA_HOME变量
变量名CATALINA_HOME
变量值c:\tomcat
没错,CATALINA_HOME的变量值与TOMCAT_HOME的变量值是一样的。
3)修改变量Path
在系统变量中找到Path变量名,双击或点击编辑,在末尾添加如下内容
;%CATALINA_HOME%\bin;%CATALINA_HOME%\lib
这里要注意,各个变量值之间一定要用;分隔。
4)启动Tomcat服务器
在cmd命令窗口下输入startup回车,运行如下图所示
测试Tomcat服务器是否安装成功
在浏览器中输入http://http://localhost:8080或http://127.0.0.1:8080
安装成功将如下图所示
4.上面是讲解的tomcat环境的安装,然后是吧项目放在服务器上了
首先把你的项目包打包成war文件格式,可在你的eclipse里项目右键选择export里的war格式即可
然后把你的文件拷贝到你tomcat文件里的webapps下即可
然后启动服务器,在网页输入http://localhost:8080/项目/xx.jsp就可以啦
以上是自己配置项目是吧 ,是不是觉得有点麻烦!那么还有个简单点的(前提jdk环境和tomcat环境已配置好的情况下)
1.你要找到你所在tomcat的所在路径,找到conf里的tomcat-users.xml文件
然后打开它,把 <tomcat-users>里的东西改成如下部分:
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
to operate the "/manager/html" web application. If you wish to use this app,
you must define such a user - the username and password are arbitrary. It is
strongly recommended that you do NOT use one of the users in the commented out
section below since they are intended for use with the examples web
application.
-->
<!--
NOTE: The sample user and role entries below are intended for use with the
examples web application. They are wrapped in a comment and thus are ignored
when reading this file. If you wish to configure these users for use with the
examples web application, do not forget to remove the <!.. ..> that surrounds
them. You will also need to set the passwords to something appropriate.
-->
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
</tomcat-users>
这里视为tomcat创建管理web用户
然后打开http://localhost:8080/ 的tomcat主页面
然后找到右上角的
的Manager App
点进去然后输入你设置的用户名 和密码 ,然后你就进入一个页面 点击页面
的这个 页面 然后把你的web项目Deploy进去就可以啦
然后你就会看见
这里就有你的项目名啦 ,
点击一下 看能访问不
添加项目就这么esay!!