Eclipse 未构建项目

发布于 2024-11-28 11:24:30 字数 320 浏览 1 评论 0原文

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

当我尝试构建课程时,什么也没有出现。什么也没发生。

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

我正在使用 tomcat 来运行 Java 应用程序。我收到错误:

无法找到 java 类。

我尝试过清洁,但没有效果。

任何帮助将不胜感激。

I am using Eclipse and I've set the output folder to WebContent/WEB-INF/classes. The default was 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.

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

Unable to find java class.

I tried cleaning and it didn't work.

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

流绪微梦 2024-12-05 11:24:30

检查项目是否正确构建。

转到项目属性,选择Java Build Path,然后选择其中的Source选项卡。

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

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

通过导出 WAR 文件检查类是否正确位于所需位置。

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

正确加载 Eclipse 设置。

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

Check that the Project is built properly.

Go to project properties ,select Java Build Path and select Source tab in that.

In Source tab make sure that the path for Default output folder is correct.

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

required locations by exporting WAR file.

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

are loaded properly.

Hope all these things help you.

梦里的微风 2024-12-05 11:24:30

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

我的工作区中有两个项目,一个是在代码更改的基础上构建的,另一个则没有。

我的解决方案是:

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

因此,我手动编辑了 .project 文件并添加:

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

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

希望这有帮助..

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'.

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

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

Reload the project and now all is working well!

Hope this help..

前事休说 2024-12-05 11:24:30

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

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.

脸赞 2024-12-05 11:24:30

像 Package Explorer 和 Project Explorer 这样的视图会过滤掉编译器输出目录,因为它们大多数时候只是噪音。如果您需要完全按照文件系统上的方式浏览项目目录,则应打开导航器视图。

Tomcat 的问题无关。

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.

[旋木] 2024-12-05 11:24:30

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

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

花开半夏魅人心 2024-12-05 11:24:30

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

  1. 从 eclipse 中删除了该项目。从项目文件夹中删除了 .settings、.classpath 和 .project 文件。
  2. 将项目导入到eclipse中-导入->一般->文件夹或存档中的项目 ->目录-> {项目路径}。
  3. 构建项目-右键单击项目->构建项目。
  4. 清洁并运行

希望这对某人有帮助!

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

Hope this helps someone!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文