下载JDK(这个不多说,网上一大摞)
下载TomCat
这个的话上官网http://tomcat.apache.org/ 下载也可以,其他地方都可以
下载下来是.exe的话就直接点下一步....
下载下来是rar解压后只有一些文件夹和几个文件的话,就是直接不用安装了...
接下来是重点.
右键 我的电脑(计算机)->属性->高级系统设置
然后上方选 高级->环境变量
http://jingyan.baidu.com/article/870c6fc33e62bcb03fe4be90.html
可以参考上面这个...
总结起来就是要
添加这些东西:
①名称:JAVA_HOME
变量值:刚刚安装的路径
②名称:CLASS_PATH
变量值:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
③变量名:CATALINA_HOME
变量值:刚刚安装的路径
④变量名:CATALINA_PATH
变量值:刚刚安装的路径
⑤找到变量名为:path
编辑再最后加上 ;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar ;
%CATALINA_HOME%\lib;%CATALINA_HOME%\bin;
以上.
在cmd输入java -version 可以看是否安装JDK成功
输入 startup 可以看是否启动到tomcat
成功之后登上http://localhost:8080/ 如果是tomcat画面就成了!
先点去status看~发现要账号密码.
这个需要到安装的目录那找到apache-tomcat-6.0.41\conf\tomcat-user.xml 这个文件
用记事本打开.
<span style="font-size:12px;"><?xml version='1.0' encoding='utf-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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.
-->
<!--
NOTE: The sample user and role entries below are wrapped in a comment
and thus are ignored when reading this file. Do not forget to remove
<!.. ..> that surrounds them.
-->
<!--
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="jie" password="123321" roles="manager-gui,admin-gui"/>
</tomcat-users></span>
我倒数三行是我自己加上去的,上面的<!-- -->都是注释这个学过xml的应该都知道
所以需要添加一个角色给他.
保存.然后关闭浏览器 .
重新在 win+ R 弹出命令运行, 输入 cmd ,然后再输入 startup
重启tomcat
这是再登陆http://localhost:8080/manager/status 就发现输入正确密码就可以了.
最后如何实现服务器共享?
找到apache-tomcat-6.0.41\webapps\ROOT\
在上面建的东西就是共享的么么哒啦.
举个例子:再目录下建立一个 test文本
然后登陆http://localhost:8080/test.txt
就有了...