说明:
IntelliJ IDEA 版本为14.
JDK 版本为1.7
tomcat 版本为apache-tomcat-7.0.70注:在创建过程中注意相关软件版本位数的问题。32位,64位的软件混搭会导致访问不成功的问题!!!
首先要理解一个基本问题:对比eclipse ,在IntelliJ IDEA中“new Project”相当于eclipse中的工作空间(Workspace),而“new Module”相当于eclipse中的工程(Project)。以下均采用Intellij的说法,请自行对照转换理解。
1,创建Project:依次点击File–new Project;
![](https://i-blog.csdnimg.cn/blog_migrate/4ac17767a9fc7d51d430c9e130ad6aa6.webp?x-image-process=image/format,png)
创建.png
2,选择Empty Project项目,点击Next;
![](https://i-blog.csdnimg.cn/blog_migrate/4e73734dc0a345236a0088c577810b93.webp?x-image-process=image/format,png)
下一步
3,输入项目名称,选择项目路径;
![](https://i-blog.csdnimg.cn/blog_migrate/21876fe6732673269f222074fb239758.webp?x-image-process=image/format,png)
Paste_Image.png
4,创建Module:点击Finish,弹出下面窗口,Intellij默认选择Modules,点击加号,选择New Module;
![](https://i-blog.csdnimg.cn/blog_migrate/5770915614e71ed0311de6fc291520d9.webp?x-image-process=image/format,png)
Paste_Image.png
5,选择Java,配置Module SDK,选择Web Application,配置Versions,点击Next;
![](https://i-blog.csdnimg.cn/blog_migrate/ce230a134c57aa35bfb938250ed160db.webp?x-image-process=image/format,png)
Paste_Image.png
6,输入Module Name,点击Finish。
![](https://i-blog.csdnimg.cn/blog_migrate/b993f17466e497a6aa9ec7bfadb6908e.webp?x-image-process=image/format,png)
Paste_Image.png
7,选择Project,配置SDK;
![](https://i-blog.csdnimg.cn/blog_migrate/71236a095ec3507c66e2a347570dba8b.webp?x-image-process=image/format,png)
Paste_Image.png
8,选择Modules–(Modules名称)–Sources–web–WEB-INF;
![](https://i-blog.csdnimg.cn/blog_migrate/fbe4e5f78164dffa05ea039a3945d70a.webp?x-image-process=image/format,png)
Paste_Image.png
9,右击WEB-INF,依次new folder,创建classes目录和lib目录;
![](https://i-blog.csdnimg.cn/blog_migrate/b0f68af631678ee030e05d5a140107bc.webp?x-image-process=image/format,png)
Paste_Image.png
10,选择Paths,选择Use Modules complie Output path,指定路径为上面创建的classes目录;
![](https://i-blog.csdnimg.cn/blog_migrate/c76b16ea169e97bc32d696d1bcc0d89f.webp?x-image-process=image/format,png)
Paste_Image.png
11,选择Dependencies,点击右边的加号,选择第一个jars and ……,选择上面创建的lib目录,点击OK,弹出框选择jar Directory,点击OK,点击下面OK,完成项目配置;
![](https://i-blog.csdnimg.cn/blog_migrate/cbab241b5382d1f369c1b410b618a3a6.webp?x-image-process=image/format,png)
Paste_Image.png
12,配置项目:打开index.jsp,输入显示内容,比如“ 测试。。。”
![](https://i-blog.csdnimg.cn/blog_migrate/e3f902d664583d6d72da2e13e168082c.webp?x-image-process=image/format,png)
Paste_Image.png
13,配置项目服务器;
![](https://i-blog.csdnimg.cn/blog_migrate/6698a2521a16b8a8724fd38f188d28b6.webp?x-image-process=image/format,png)
Paste_Image.png
14,点击加号,选择tomcat server,选local;
![](https://i-blog.csdnimg.cn/blog_migrate/55bc8d34c5130056e09177c9e2a51f2c.webp?x-image-process=image/format,png)
Paste_Image.png
15,配置name、server、端口号;
![](https://i-blog.csdnimg.cn/blog_migrate/4ca577b22da5d4ded88204377c0252f9.webp?x-image-process=image/format,png)
Paste_Image.png
16,选择Deployment,点击+号,选择上面配置的项目;
![](https://i-blog.csdnimg.cn/blog_migrate/90e004a996eb47d2daf952e2e1dde0d1.webp?x-image-process=image/format,png)
Paste_Image.png
17,设置Application context,点击OK,完成tomcat配置;
![](https://i-blog.csdnimg.cn/blog_migrate/c8a44a5af791c019951e0ea76178e7f5.webp?x-image-process=image/format,png)
Paste_Image.png
18,启动项目
![](https://i-blog.csdnimg.cn/blog_migrate/81809ee745d634b66b2d1902410f23e7.webp?x-image-process=image/format,png)
Paste_Image.png
![](https://i-blog.csdnimg.cn/blog_migrate/605048431212fa4ae310ef8257263e4a.webp?x-image-process=image/format,png)
Paste_Image.png
自此完成IDEA的整个项目的创建、配置与启动。
原文地址:https://www.cnblogs.com/jxldjsn/p/8203859.html