简体   繁体   English

在Eclipse中设置开发的Java项目

[英]Setting Up Developed Java Project in Eclipse

I am trying to set up some project in Eclipse which is already developed and has following file structure. 我试图在Eclipse中建立一些项目,该项目已经开发并且具有以下文件结构。

根文件夹文件

WEB-INF文件

I know how to setup things in Eclipse and how to run it with Apache Tomcat but when I restart Tomcat it tries to build the web app with tons of errors. 我知道如何在Eclipse中进行设置以及如何与Apache Tomcat一起运行,但是当我重新启动Tomcat时,它将尝试构建带有大量错误的Web应用程序。 The errors are like failed to load libraries (.JAR) and the like. 这些错误就像无法加载库(.JAR)之类。 Let me tell you the project is loaded and set in Eclipse perfectly without any single Error. 让我告诉您,完美地在Eclipse中加载和设置了项目,没有任何错误。 There are many packages in the project as well as JSP files. 有项目许多包以及JSP文件。 Why this is not working with Tomcat? 为什么这不适用于Tomcat?

Ok, you have to set the build path of your project, that is right button click over the project, then build path. 好的,您必须设置项目的构建路径,即右键单击项目,然后构建路径。 That build path must point to your java libraries, or almost every line of the project will be an error. 该构建路径必须指向您的Java库,否则项目的几乎每一行都会出错。

Get the original WAR file or if there is none, just zip the whole content in a single file which you rename with .war extension. 获取原始的WAR文件,或者如果没有原始文件,只需将整个内容压缩到单个文件中,并以.war扩展名重命名即可。 Finally, if you have Eclipse for Java EE version, you can just do File > Import > WAR and select the file. 最后,如果您具有Eclipse for Java EE版本,则只需执行File> Import> WAR并选择文件。 Eclipse will automatically create a new Dynamic Web Project based on the WAR. Eclipse将基于WAR自动创建一个新的Dynamic Web Project If you have standard Eclipse version for Java (non-EE), then you need to upgrade Eclispe first. 如果您具有Java的标准Eclipse版本(非EE),则需要首先升级Eclispe。

However, if the WAR doesn't contain source code (the .java files) of the Java classes (the .class files) present in /WEB-INF/classes , then you'll need to decompile them with some Java decompiler like JD and then create the package structure with those decompiled classes in the project's source folder yourself. 但是,如果WAR不包含/WEB-INF/classes存在的Java类( .class文件)的源代码( .java文件),那么您将需要使用JD之类的 Java反编译器对其进行反编译。然后使用项目源文件夹中的反编译类创建包结构。

As to the exceptions/errors you get when running it locally, you just need to fix them one by one , starting with the firstmost one. 至于在本地运行它时遇到的异常/错误,您只需要一个一个地修复它们,从第一个开始。 More than often some if not all of the subsequent errors will just disppear. 如果不是随后的所有错误,往往会消失,甚至更多。 If you fail in understanding the first exception/error, just press Ask Question on the right top here. 如果您无法理解第一个异常/错误,只需按此处右上角的“ Ask Question ”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM