Eclipse 不构建项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6955347/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:46:34  来源:igfitidea点击:

Eclipse not building project

eclipsetomcatbuildproject

提问by st_sarc

I am using Eclipse and I've set the output folder to WebContent/WEB-INF/classes. The default was build/classes.

我正在使用 Eclipse,并将输出文件夹设置为WebContent/WEB-INF/classes. 默认为build/classes.

When I try to build the classes, nothing shows up. Nothing happens.

当我尝试构建类时,没有任何显示。没发生什么事。

When I check the directory in the explorer, the class files are generated. But they are not shown in Eclipse.

当我检查资源管理器中的目录时,会生成类文件。但是它们没有显示在 Eclipse 中。

I am using tomcatto run the Java app. I get an error:

tomcat用来运行 Java 应用程序。我收到一个错误:

Unable to find java class.

无法找到 Java 类。

I tried cleaning and it didn't work.

我尝试清洁,但没有用。

Any help would be greatly appreciated.

任何帮助将不胜感激。

采纳答案by Konstantin Komissarchik

Views like Package Explorer and Project Explorer, filter out compiler output directories as they are just noise most of the time. If you need to browse the project directory exactly as it is on the file system, you should open the Navigator view.

像包资源管理器和项目资源管理器这样的视图会过滤掉编译器输出目录,因为它们在大多数情况下只是噪音。如果您需要完全按照文件系统上的方式浏览项目目录,您应该打开导航器视图。

The issue with Tomcat is unrelated.

Tomcat 的问题是无关的。

回答by Srikanth Venkatesh

Check that the Project is built properly.

检查项目是否正确构建。

Go to project properties ,select Java Build Pathand select Sourcetab in that.

转到项目属性,选择Java Build Path并在其中选择Source选项卡。

In Sourcetab make sure that the path for Default output folderis correct.

在“源”选项卡中,确保默认输出文件夹的路径正确。

As the project will be deployed in Tomcat server .Check the classes are properly in the

由于项目将部署在Tomcat服务器中。检查类在

required locations by exporting WARfile.

通过导出WAR文件所需的位置。

If the problem persists , close the project and open it again so that the eclipse settings

如果问题仍然存在,请关闭项目并再次打开它,以便 eclipse 设置

are loaded properly.

正确加载。

Hope all these things help you.

希望所有这些事情对你有帮助。

回答by Eibi

I have had the same problem and found the solution:

我遇到了同样的问题并找到了解决方案:

I had two projects in my workspace, one was building on code change and one did not.

我的工作区中有两个项目,一个是基于代码更改而构建的,另一个则不是。

The solution for me was:

我的解决方案是:

When I entered project -> properties -> builders, one project was missing the 'Java Builder'.

当我进入项目 -> 属性 -> builders 时,有一个项目缺少“Java Builder”。

So I have manually edited the .project file and added:

所以我手动编辑了 .project 文件并添加了:

<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>

Reload the project and now all is working well!

重新加载项目,现在一切正常!

Hope this help..

希望这有帮助..

回答by user2102145

Go in "java Build path" and check Libraries Tab. is there any jar file showing error symbol(jar file path is missing) then delete that jar and add again. this is one of the reason if eclipse is not building class file.

进入“java Build path”并检查库选项卡。是否有任何 jar 文件显示错误符号(缺少 jar 文件路径)然后删除该 jar 并再次添加。如果 eclipse 没有构建类文件,这是原因之一。

回答by vinayHR

Go to View menu (in project explorer right top corner) ----> Customize veiw ----> Uncheck "java output folder".

转到查看菜单(在项目资源管理器右上角)----> 自定义视图 ----> 取消选中“java 输出文件夹”。

回答by Najeeba Saidalavi

I had this issue and here is what I did:

我遇到了这个问题,这就是我所做的:

  1. Deleted the project from eclipse. Deleted the .settings, .classpath and .project file from the project folder.
  2. Imported the project to eclipse - Import -> General -> Projects from Folder or Archive -> Directory -> {path of project}.
  3. Built the project - Right click the project -> Build Project.
  4. Clean and run
  1. 从 eclipse 中删除了该项目。从项目文件夹中删除了 .settings、.classpath 和 .project 文件。
  2. 将项目导入 Eclipse - 导入 -> 常规 -> 文件夹或存档中的项目 -> 目录 -> {项目路径}。
  3. 构建项目 - 右键单击​​项目 -> 构建项目。
  4. 清洁并运行

Hope this helps someone!

希望这对某人有帮助!