[英]Importing Dynamic Web Project into Eclipse
I've been working on a dynamic web project in Eclipse.我一直在 Eclipse 中开发一个动态 Web 项目。 I have recently reInstalled my OS and I use a clean eclipse.
我最近重新安装了我的操作系统并且我使用了一个干净的 Eclipse。 I can import my web project, but when I try to lunch (run on server) I always get this message:
我可以导入我的 Web 项目,但是当我尝试吃午饭(在服务器上运行)时,我总是收到以下消息:
"The selection cannot be run on any server"
I installed the eclipse's tomcat plugin, and it works fine.我安装了eclipse的tomcat插件,运行正常。 I set the tomcat library too.
我也设置了 tomcat 库。 (window/preferences/tomcat).
(窗口/首选项/ tomcat)。
What's the problem with it?它有什么问题?
If you import an exported dynamic web project
, eclipse will import it as a java project
.如果您导入一个导出的
dynamic web project
,eclipse 会将它作为一个java project
导入。 You have to change the project type manually.您必须手动更改项目类型。 For example like this: convert java project to dynamic web project
例如像这样: 将 java 项目转换为动态 web 项目
If I understand you correctly you have imported a previously working web project into a clean install of Eclipse (and OS) and you are tying to run the project on Tomcat.如果我对您的理解正确,您已经将以前工作的 Web 项目导入到 Eclipse(和操作系统)的全新安装中,并且您正准备在 Tomcat 上运行该项目。 There could be a number of reasons why it isn't working, here are some things to consider in troubleshooting:
它不工作的原因可能有很多,以下是故障排除时需要考虑的一些事项:
OK.好的。 My experience is not exactly the same as the poster, but rather than ask a similar question and answer it myself, I'll add my two pennyworth here.
我的经历与海报不完全相同,但与其提出类似的问题并自己回答,我将在这里添加我的两个便士。
When I have tried to import a dynamic web project from work onto my home machine — both Eclipse projects — using当我尝试将一个动态 Web 项目从工作导入到我的家用机器上时——两个 Eclipse 项目——使用
Import -> Existing Projects into Workspace导入 -> 现有项目到工作区
I have always ended up with a red exclamation mark against my imported project.我的导入项目总是以红色感叹号结束。 Googling indicates that this means the project contains build path errors.
谷歌搜索表明这意味着该项目包含构建路径错误。 Following the advice in the ticked answer above I
按照上面勾选答案中的建议,我
"Right click the project -> Build path -> Configure build path". “右键单击项目-> 构建路径-> 配置构建路径”。
There I find that the JRE System Library has a red cross against it.在那里,我发现 JRE 系统库对它有一个红十字。 What to do?
该怎么办? This worked:
这有效:
Delete the JRE System library entry using the Remove button.使用删除按钮删除 JRE 系统库条目。
Click the Add Library button and select JRE System library.单击添加库按钮并选择 JRE 系统库。 I accepted the default Workspace default JRE.
我接受了默认的 Workspace 默认 JRE。
So I don't have the reconstruction fag any more.所以我不再有重建同性恋了。 (I assume there must be differences between the installations on the two machines, although both are running the same version of Mac OS.)
(我认为两台机器上的安装肯定存在差异,尽管两者都运行相同版本的 Mac OS。)
On the dialog before you get the "The selection cannot be run on any server" alert, in the upper right side it tells you why you can't add it to the selected server.在收到“无法在任何服务器上运行选择”警报之前的对话框中,右上角会告诉您为什么无法将其添加到所选服务器。 For me, it was because my Tomcat 8.0 server couldn't run JRE 1.8 projects.
对我来说,这是因为我的 Tomcat 8.0 服务器无法运行 JRE 1.8 项目。
I solved it by creating a new Tomcat 8.0 server, changing the runtime environment from Tomcat 8.0 to my 1.8 jre.我通过创建一个新的 Tomcat 8.0 服务器,将运行时环境从 Tomcat 8.0 更改为我的 1.8 jre 来解决它。 Then I could run my project on the new server.
然后我可以在新服务器上运行我的项目。
I know this is too late but it will help a googler who accidentally stumbled here while chasing the rabbit hole.我知道这为时已晚,但它会帮助一个在追逐兔子洞时不小心在这里绊倒的谷歌员工。 Make sure java version stated in the project facet is compatible with your tomcat.
确保项目方面中声明的 java 版本与您的 tomcat 兼容。 Project facet->java (you can right click and change the version)
项目facet->java(可以右键更改版本)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.