干净win7要做几步才能运行第一个Spring MVC 写的动态web程序:
1. 下载安装jdk
2. 配置Java环境变量
3. 测试一下第1,2两步是否完全成功:http://jingyan.baidu.com/article/14bd256e2e3e0cbb6d261201.html
3. 下载安装Eclipse J2EE luna(一定要是j2EE版本,否则会有jar包缺失引起internal error,补起来很麻烦)
4. 在Eclipse中安装Spring Tool Suite(不要纠结SpringIDE与SpringToolSuite的区别,STS就好。)
Help >> Eclipse Marketplace >> Search: Spring Tool Suite >> Install the one that matches.
5. 下载解压Tomcat: http://tomcat.apache.org/download-80.cgi
选择符合你机器的版本和格式进行下载,解压放在你喜欢的路径下。
6. 配置tomcat环境变量:
配置Tomcat环境变量
1,新建变量名:CATALINA_BASE,变量值:C:\tomcat
2,新建变量名:CATALINA_HOME,变量值:C:\tomcat
3,打开PATH,添加变量值:%CATALINA_HOME%\lib;%CATALINA_HOME%\bin
参考:http://jingyan.baidu.com/article/8065f87fcc0f182330249841.html
7. 为了能方便调试,Eclipse设置Tomcat运行环境:
Window >> Preferences >> Server >> Runtime Environment >> Add... >> Select your tomcat Path >> OK
8. Configure your tomcat in Eclipse:
Run >> Run Configuration >> Right click "Apache Tomcat" >> new >> name: myTomcat >> OK
9. 建立Spring MVC项目,总算来了:
File >> new >> Project >> Spring/Spring Project >> Project name, Templates:SpringMVC ...
Eclipse已经预置了一个简单的Hello world代码结构,所以下一步是运行一下看看。
10.运行Run Project
Right click the project root in PackageExplorer on the right side of Eclipse's window shown in the image below:
Enjoy.