Spring Tools Suite(STS)的下载与安装

1.下载安装STS

(1)在官网上下载STS,以win10 64位系统为例,下载STS 3.9.4


(2)将下载压缩文件进行解压,在解压文件夹中sts-bundle---sts-3.9.4.RELEASE--STS,双击STS进行安装



(3)安装过程中,选择工作环境,即你的项目存放处


(4)安装成功后如下所示


2.STS优化设置

(1)在STS中部署tomcat

打开STS,在菜单导航栏选择Window--Preferences --Server--Runtime Environments--Add--Apache,选择Tomcat的版本--选择Tomcat的安装路径--Finish


tomcat部署成功后如下所示


(2)将STS中的编码格式修改为UTF-8

     a. 在菜单导航栏选择Window--Preferences--General--Workspace,将左下角的Text file encoding选择为Other,在Other的下拉框中选择UTF-8--Apply--Apply and Close

    b.在菜单导航栏选择Window--Preferences--Web--JSP Files,在Encoding下拉框中选择UTF-8--Apply--Apply and Close
    c.在菜单导航栏选择Window--Preferences--General--Appearance--Content Types,在后边的窗口点击Text,在下边的Default encoding中输入utf-8--Update--Apply and Close

(3)在STS的项目中导入postgresql驱动jar包,例如在项目myFirstWeb中导入

   将postgresql驱动jar包粘贴到WebContent--WEB-INF--lib文件夹里--右击该项目名称,选择Build Path--Configeure Build Path,勾选该驱动--Apply--Apply and Close

3.在新版本的STS中导入旧版本的STS的web项目,现在jdk版本为jdk10,原版本为jdk8;sts中的Servers为v4.0,原版本为v3.2

例如:导入myServerlet项目

(1)在菜单栏点击File--import,选择General--Existing Projects into Workspce--Next,选择你要导入的web项目--Finish。


这时你会发现你新导入项目上和WebContent文件夹上有个小红叉

(2)a. 右击项目名DynamicW--Build Path--Configure Build Path--Java Build Path,在右边的Libraries界面,选择前面有小红叉的JRE System Library--Remove

b. 移除之后,点击右边Add Library--JRE System Library--Next--Enviroments--选择Execution Environmrnt中的JavaSE-10,勾选右边的jre-10[perfect match]--Apply and Close--Finish

添加完JRE System Library[jre-10]之后如下所示

c. 添加完JRE System Library[jre-10],再选择Server Library--Remove
d. 移除Server Library之后,点击Add Library--Server Runtime--Next,选择Apache Tomcat--Finish--Apply--Apply and Close

添加完tomcat之后如下显示

e. 然后再选择Add JARs--WebContent--WEB-INF--lib下的jar包--OK--Apply--Apply and Close

以上步骤完成之后,你会发现WebContent文件夹前的小红叉不见了,但是项目名前的小红叉还在

(3)右击项目名DynamicW--Build Path--Configure Build Path--Java Compiler--在Copiler compliance lever下拉菜单里选择10--Apply--Yes

(4)再选择左边的Project Facets--在右边的在勾选选项Dynamic Web Services的右边下拉菜单里选择4.0--在右边的在勾选选项Dynamic Web Services的右边下拉菜单里选择4.0--Apply--Apply and Close

以上步骤完成之后,项目名前的小红叉也不见了

猜你喜欢

转载自blog.csdn.net/m0_37920381/article/details/79972438