Java 如何在eclipse中打开现有的tomcat web应用项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18372325/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to open existing tomcat web application project in eclipse
提问by Harishsingh Thakur
I want to open my web application which I made using Terminal/Text Editor on Linux into eclipse on windows.
我想将我在 Linux 上使用终端/文本编辑器制作的 Web 应用程序打开到 Windows 上的 eclipse 中。
I tried to open it by doing Import existing project
but I don't see my servlet files i.e .java files
in it and i also see error mark on my WEB.XML.
ty154 is my project name.
My Directory structure is
Tomcat -> Webapp->ty154
我试图通过这样做来打开它,Import existing project
但我没有看到我的 servlet 文件,即.java files
在其中我也看到了我的 WEB.XML 上的错误标记。ty154 是我的项目名称。我的目录结构是Tomcat -> Webapp->ty154
Ty154->Images & ->webinfo
Ty154->图像和->网络信息
Webinfo->classes
网络信息->课程
I have my JSP files in the ty154 folder and Images inside Image folder. I have my .JAVA and .Class file inside Classes folder.
我在 ty154 文件夹中有我的 JSP 文件,在 Image 文件夹中有图像。我在 Classes 文件夹中有我的 .JAVA 和 .Class 文件。
Please help me how to open and configure my project in eclipse.
请帮助我如何在 Eclipse 中打开和配置我的项目。
Thanks in advance !!
提前致谢 !!
回答by Juned Ahsan
As you have written source code in terminal environment so you wouldn't be having an eclipse project file to be imported properly. First you need to create an eclipse project and then you can add source from your code directories. This link describes it pretty well:
由于您在终端环境中编写了源代码,因此您将无法正确导入 Eclipse 项目文件。首先您需要创建一个 eclipse 项目,然后您可以从您的代码目录中添加源代码。这个链接很好地描述了它:
http://thusithamabotuwana.wordpress.com/2011/06/15/importing-existing-source-code-into-eclipse/
http://thusithamabotuwana.wordpress.com/2011/06/15/importing-existing-source-code-into-eclipse/
回答by Rakesh
If you have the war file, then you can import the war file directly in eclipse. Go to File>import
then select war
如果你有war文件,那么你可以直接在eclipse中导入war文件。转到File>import
然后选择war
For this you need to have Eclipse IDE for Java EE developers
为此,您需要为 Java EE 开发人员安装Eclipse IDE
回答by Thorbj?rn Ravn Andersen
The "Import Existing Project" entry only works for Eclipse projects.
“导入现有项目”条目仅适用于 Eclipse 项目。
In your situation with a simple project I would create a new Dynamic Web project and copy in the sources to the source folder - just Ctrl-c the files outside Eclipse, and Ctrl-v them inside Eclipse - and the static files to the publish location. You essentially need to know what has been done to ensure it has been done right.
在您使用简单项目的情况下,我将创建一个新的动态 Web 项目并将源文件复制到源文件夹中 - 只需 Ctrl-c Eclipse 外部的文件,Ctrl-v Eclipse 内部的文件 - 将静态文件复制到发布位置. 您基本上需要知道已经做了什么以确保它做得正确。
回答by Vivek
Its not possible to import the project that you have created using terminal/text editor in to eclipse.You have to create a Dynamic Web Project under eclipse and copy paste the java files under source directory of the project. The jsp and other html files will go in to WebContents folder of the project. Once this is done the eclipse project can be copied and can be imported in to any other eclipse installations.The best read is:http://goo.gl/hPVapt
无法将使用终端/文本编辑器创建的项目导入到eclipse 中。您必须在eclipse 下创建一个动态Web 项目,并将java 文件复制粘贴到项目的源目录下。jsp 和其他 html 文件将进入项目的 WebContents 文件夹。完成此操作后,可以复制 eclipse 项目并可以将其导入到任何其他 eclipse 安装中。最好的读物是:http: //goo.gl/hPVapt