Eclipse导入外部工程运行报错:The selection cannot be run on any server

一、错误描述

课下复习时导入老师的Demo,发现项目报错

在项目上有红色叉:

Eclipse导入外部工程运行报错:The selection cannot be run on any server

运行时报如下错误:

Eclipse导入外部工程运行报错:The selection cannot be run on any server

二、解决步骤

1.在项目上右键---->Properties

Eclipse导入外部工程运行报错:The selection cannot be run on any server

2.打开Java Build Path

发现JDK和Tomcat都未绑定,这是原先项目的,现在在你的eclipse中,需要绑定你的

Eclipse导入外部工程运行报错:The selection cannot be run on any server

选择这两个,点击Remove

Eclipse导入外部工程运行报错:The selection cannot be run on any server

再点击Add Liabrary,添加JRE

Eclipse导入外部工程运行报错:The selection cannot be run on any server

Eclipse导入外部工程运行报错:The selection cannot be run on any server

再次点击Add Library,添加Server Runtime

Eclipse导入外部工程运行报错:The selection cannot be run on any server

Eclipse导入外部工程运行报错:The selection cannot be run on any server

3.点击Project Facet,点击右侧的Runtimes,取消勾选原来的8.0,勾选我的eclipse中使用的tomcat版本9.0,点击Apply,关闭Eclipse导入外部工程运行报错:The selection cannot be run on any server

导入的项目就不报红了

Eclipse导入外部工程运行报错:The selection cannot be run on any server